[PHP] anyone care to explain the logic behind this output ....

2006-02-17 Thread Jochem Maas
THIS CODE php -r ' $a = array(0, 1); $b = array(1 = 0, 0 = 1); var_dump($a $b); // true var_dump($a $b); // true var_dump($b $a); var_dump($b $a); echo \n\$a:\n; var_dump((bool)$a, (int)$a, (string)$a, intval($a),

Re: [PHP] anyone care to explain the logic behind this output ....

2006-02-17 Thread Robin Vickery
On 17/02/06, Jochem Maas [EMAIL PROTECTED] wrote: THIS CODE php -r ' $a = array(0, 1); $b = array(1 = 0, 0 = 1); var_dump($a $b); // true var_dump($a $b); // true var_dump($b $a); var_dump($b $a); [...]

Re: [PHP] anyone care to explain the logic behind this output ....

2006-02-17 Thread Jochem Maas
Robin Vickery wrote: On 17/02/06, Jochem Maas [EMAIL PROTECTED] wrote: THIS CODE php -r ' $a = array(0, 1); $b = array(1 = 0, 0 = 1); var_dump($a $b); // true var_dump($a $b); // true var_dump($b $a); var_dump($b $a);

Re: [PHP] anyone care to explain the logic behind this output ....

2006-02-17 Thread David Tulloh
(Don't you hate it when people forget to post back to the list...) The secret is actually hidden in the docs, http://php.net/manual/en/language.operators.comparison.php When comparing $a $b, you compare the first value of $a (0) to the value with the same key in $b (1). 0 1 -- true When you