+ 2
Echo print
Why this code prints 31? Echo print 3; It prints 3 because of the echo and then 1 because echo is true? Thank you.
4 Answers
+ 3
razvan ,
print $some_arg;
prints value of $some_arg and as function returns 1.
so function always_one in code bellow always return 1:
function always_one(){
return print 25;
}
echo always_one();
#the output will be:
#251
because print 25; output 25 and return 1, which will be output in echo statement...
Sorry for my English if I wrote with errors in grammatic
+ 3
i believe so. "print 3" prints 3 and then echo just prints the result of that which is 1. php is just like that sometimes
+ 2
i think it is because print always prints 1
so in this example echo will output 3 and then print will output 1.
+ 2
thank you for the explanaition.