Help in understanding &

When execute below code

<?php
$cfg=array();
$curpath=array();
$name="check";
array_push($curpath, strtolower($name));
$ptr =& $cfg;
/*what happens here*/
$ptr =& $ptr[$name];

print("\ncfg\n");
print_r($cfg);
?>
``
output below after execution of above code:
cfg
 Array ( [check] => )  

Pls explain below statements:
$ptr =& $cfg;
/*what happens here*/
$ptr =& $ptr[$name];

it’s explained in the manual

https://www.php.net/manual/en/language.operators.assignment.php

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service