Im wondering if its good practice to pass-by-reference when you are only reading a variable, or if it should always be passed as a value.
Example with pass-by-reference:
$a = 'fish and chips';
$b = do_my_hash($a);
echo $b;
function &do_my_hash(&$value){
return md5($value);
}
Example with pass-by-value:
$a = 'fish and chips';
$b = do_my_hash($a);
echo $b;
function do_my_hash($value){
return md5($value);
}
Which is better ? E.g if I was to run a loop with 1000 rounds ?
Example of loop:
for($i = 0 ; $i < 1000 ; $i++){
$a = 'Fish & Chips '.$i;
echo do_my_hash($a);
}