How check memory location of variable in php?

前端 未结 6 1173
旧时难觅i
旧时难觅i 2020-12-06 10:05

How check memory location of variable in php?

Thanks

6条回答
  •  萌比男神i
    2020-12-06 10:39

    To test if one variable is a reference to another you can do the following:

    function is_ref_to(&$a, &$b)
    {
        $t = $a;
        if($r=($b===($a=1))){ $r = ($b===($a=0)); }
        $a = $t;
        return $r;
    }
    

提交回复
热议问题