View Single Post
Old 03-08-2008, 07:44 PM   #20 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
HOLY SMOKES, blast from the past How's life BDL? Good to see you around.



yes, json works in multi-dimensional arrays.

i.e.
PHP Code:
<?php

$array
['foo']['bar'] = 'moo';

echo 
json_encode($array);
?>
to access moo in javascript, it would be something like: data.foo.bar

to add on to what bdl is saying, it wasn't available in php 4.x, and maybe not even utnil 5.2 (i'm not looking at the man page for it so i'm not sure)

still though, if you didn't have access to the later versions of php, there are scripts you can find that define a json_encode() function to use. that is if you didn't feel like building it manually.
__________________
testing 1 2 3
sde is offline   Reply With Quote