How check memory location of variable in php?
Thanks
As others have said, the API does not expose a way to retrieve a value's address. However, you can compare the addresses of two values, given two variables. Here's a function that tests whether two variables reference the same value:
function vars_reference_same_value(&$a, &$b)
{
$not_b = $b === 0 ? 1 : 0;
$a_orig = $a;
$a = $not_b;
$is_ref = $b === $not_b;
$a = $a_orig;
return $is_ref;
}
(This is the same as @infinity's answer, but perhaps more comprehensible.)