Junior
Is the value assigned by reference or by value?
sobes.tech AI
Answer from AI
By default value. By reference when using the & operator.
<?php
$a = 5;
$b = $a; // assignment by value, $b = 5
$a = 10; // $b remains 5
$c = 5;
$d = &$c; // assignment by reference, $d references $c
$c = 10; // $d also becomes 10
?>