For example are the following two functions the same or not when one compares how memory is being managed:
$hello = 'hello';
my_echo($hello);
//Better or worse than
my_echo_ref($hello);
//case 1, no referencing:
function my_echo($word) {
echo $word;
}
//case 2, referencing:
function my_echo_ref(&$word) {
echo $word;
}
I don’t know how reliable this source is, but this is a very interesting article (from 2008) that explains how variables are handled:
The Truth About PHP Variables
It says
and
and
and the conclusion:
Besides that, I ran your code a few times with
get_memory_usage()and there was no difference in memory consumption (but this does not necessarily mean anything, probably the memory consumption differs when one is actually doing something with the variable).