The PHP Function
This changes things when you decode your json encoded data object.
Look at the following example I found reading a Nice Post at Stackoverflow
Here's an associative Array
json_decode()
will return associative arrays as objects:This changes things when you decode your json encoded data object.
Look at the following example I found reading a Nice Post at Stackoverflow
Here's an associative Array
$config = array(
'Frodo' => 'hobbit',
'Gimli' => 'dwarf',
'Gandalf' => 'wizard',
);
Lets act On It
print_r($config);
print_r(json_decode(json_encode($config)));
The Output is:
Array
(
[Frodo] => hobbit
[Gimli] => dwarf
[Gandalf] => wizard)
stdClass Object
(
[Frodo] => hobbit
[Gimli] => dwarf
[Gandalf] => wizard)
No comments:
Post a Comment