mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Added associative array encoding to example.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@304559 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
29fd59a70b
commit
5a37ef5632
1 changed files with 8 additions and 0 deletions
|
@ -133,6 +133,11 @@ $c = array(array(1,2,3));
|
|||
|
||||
echo "Non-associative array output as array: ", json_encode($c), "\n";
|
||||
echo "Non-associative array output as object: ", json_encode($c, JSON_FORCE_OBJECT), "\n\n";
|
||||
|
||||
$d = array('foo' => 'bar', 'baz' => 'long');
|
||||
|
||||
echo "Associative array always output as object: ", json_encode($d), "\n";
|
||||
echo "Associative array always output as object: ", json_encode($d, JSON_FORCE_OBJECT), "\n\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -151,6 +156,9 @@ Empty array output as object: {}
|
|||
|
||||
Non-associative array output as array: [[1,2,3]]
|
||||
Non-associative array output as object: {"0":{"0":1,"1":2,"2":3}}
|
||||
|
||||
Associative array always output as object: {"foo":"bar","baz":"long"}
|
||||
Associative array always output as object: {"foo":"bar","baz":"long"}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
|
Loading…
Reference in a new issue