Friday, November 20, 2009

Identify yourself!

<?
$a = array(1,2,3);
$b = array(1,2,3);

var_dump($a === $b); // true;

$a[] = 4;

var_dump($a === $b); // false

Result:
bool(true)
bool(false)


In other words: You can't check if you have two variables that point to an array are in fact pointing to different arrays or if they are pointing to the same array.

No comments:

Post a Comment