[Developers] Dealing With Arrays: PHP + MQL
Daniel O'Connor
daniel.oconnor at gmail.com
Tue Dec 16 22:07:21 UTC 2008
>
>
> It's easy enough to pull out the name and id. But I need the actor and
> character data from the starring array as well.
>
> I've tried the syntax below but that doesn't work. I'm having difficulty
> understanding how to translate the starring array to a JSON query. Any help
> appreciated.
>
var_dump() is your friend here. It will show you the structure of a variable
- be it a nested array or object.
Try
$foo = array("key" => array(1,2,3,4), "fish" => false);
var_dump($foo);
var_dump($foo['key']);
var_dump($foo['key'][0]);
var_dump($foo['fish']);
vs
class Foo {
public $key = array(1, 2, 3, 4);
public $fish = false;
}
$foo = new Foo();
var_dump($foo);
var_dump($foo->key);
var_dump($foo->key[0]);
var_dump($foo->fish);
to see what things are a bit better
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebase.com/pipermail/developers/attachments/20081217/422ff49b/attachment-0001.htm
More information about the Developers
mailing list