[Developers] Dealing With Arrays: PHP + MQL
Will Merydith
will.merydith at gmail.com
Thu Dec 18 21:15:56 UTC 2008
Thanks for var_dump, that help me understand the problem: mql expects arrays
to be defined with brackets, and there's no way to create the syntax by
building PHP arrays. I'd need to add to metaweb.php to add the proper mql
syntax for arrays (which isn't a bad idea, and I would take it on if I knew
PHP as well as I know Java).
I switched to bypassing metaweb.php and simply sending an encoded url, and
then using JSON.php to decode the result.
On Tue, Dec 16, 2008 at 4:07 PM, Daniel O'Connor
<daniel.oconnor at gmail.com>wrote:
>
>> 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
>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>
>
--
will at 3mix.com
cell 641.233.7548
CEO - http://3mix.com
Blog - http://LivingInSmallSizes.com
http://linkedin.com/in/merydith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebase.com/pipermail/developers/attachments/20081218/998dff07/attachment.htm
More information about the Developers
mailing list