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),
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);
[...]
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);
(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
4 matches
Mail list logo