(1) I want to know what is the difference between call by value and call by reference in php. PHP works on call by value or call by reference?
(2) And also i want to know that do you mean by $$ sign in php
For example:-
$a = 'name';
$$a = "Paul";
echo $name;
output is Paul
As above example what do u mean by $$ on PHP.
$$a = b;in PHP means “take the value of$a, and set the variable whose name is that value to equalb“.In other words:
But yeah, take a look at the PHP symbol reference.
As for call by value/reference – the primary difference between the two is whether or not you’re able to modify the original items that were used to call the function. See:
Notice how the value of
$xisn’t changed byincrement_value(), but is changed byincrement_reference().As demonstrated here, whether call-by-value or call-by-reference is used depends on the definition of the function being called; the default when declaring your own functions is call-by-value (but you can specify call-by-reference via the
&sigil).