1
<?php
function foo($var){
echo $var + 3;
}
$x = 1;
echo "foo($x) =".foo($x);
?>
I was watching some exercises in php
,then I came across the code, thinking I was going to print foo(1) = 4
, but printed 4foo(1) =
.
Why am I calling the job foo($x)
before the string of echo
? He believed that the code would follow the normal 'stream' of the line and first print the string and only after that would call the function foo($x).
In my interpretation, where am I missing? Or php has some particularity?
Wow! Truth, what inattention, I went unnoticed and I messed up with Return, thank you very much!!! Once the site free minino time to accept the answer, valid your
– Luiz Augusto