Hızlı yanıt: kod örneği
This will force the variable to be passed by reference. Normally, a hard copy would be created for simple types. This can come handy for large strings (performance gain) or if you want to manipulate the variable without using the return statement, eg: Objects will be passed by reference automatically.If you like to handle a copy over to a function, useThen, the original object is not altered, eg:
$a = 1;function inc(&$input){ $input++;}inc($a);echo $a; // 2
clone $object;
$a = new Obj;$a->prop = 1;$b = clone $a;$b->prop = 2; // $a->prop remains at 1