Forum PHP 2017


Please answer this simple SPAM challenge: four plus one?
(Example: nine)

The Note You're Voting On

8 years ago
You can make references like pointers. Example:
$b=array(&$a); // $b is a pointer to $a
$c=array(&$b); // $c is a pointer to $b
$c[0][0]=9; // $a is 9
$c[0]=array(&$d); // $b is a pointer to $d
$c[0][0]=4; // $d is 4
$b=array(&$a); // $b is a pointer to $a again
echo $a.$b[0].$c[0][0].$d; // outputs 9994
These kind of pointers may even be passed to functions or returned from functions, copied and stored in multiple arrays/variables/objects, etc.

<< Back to user notes page

To Top