execute the following code:
<?php $a = array('yes'); $a[] = $a; var_dump($a);
out put:
array(2) { [0]=> string(3) "yes" [1]=> array(1) { [0]=> string(3) "yes" } }
execute the following code:
<?php $a = array('no'); $b = &$a; $a[] = $b; $a = array('yes'); $a[] = $a; var_dump($a);
out put:
array(2) { [0]=> string(3) "yes" [1]=> array(2) { [0]=> string(3) "yes" [1]=> *RECURSION* } }
I reassigned the value of $ a, why do RECURSION circular references exist?
source share