$arr=array();
$arr['a']=1;
$arr['b']=2;
$arr['c']=3;
print(json_encode($arr)."\r\n"); // encode as an object (default method)
print(json_encode($arr,0)."\r\n"); // encode as an object
print(json_encode($arr,1)."\r\n"); // encode as an array
?>
The above example will output:
"$arr":{"a":1,"b":2,"c":3}
"$arr":{"a":1,"b":2,"c":3}
"$arr":{1,2,3]
====See Also====
[[array()]] - Create an array, with optional values
[[explode()]] - Turn a string into an array
[[implode()]] - Turn an array into a string
[[uphp:variables|uPHP Variable Types and Limits]]