+ 8
What is the difference between print, return and echo statement in php ?
12 Answers
+ 19
Good Question :)
return is a language construct used to exit a function and give a value to the caller of the function. echo and print are both language constructs that output strings. The main difference is that echo can take multiple arguments separated by commas, but print accepts only a single argument.
+ 15
+ 10
I seriously didn't study PHP, but good explanation Dayve!
+ 8
BTW Dave how do you not learn any language but you're close to Platinum?
+ 8
@Dayve Oh nice! Thanks for the info!
+ 3
.TV kx1c
cnn ex
k
qbw.4f
x4 quite c 2c k
4cccwx
+ 2
Just note that print will return 1 always, but echo will not. Also, echo is a little bit faster.
+ 2
.
ob
+ 1
echo and print are both language construct
+ 1
2k wlwicc1 4eq1 ww isbj.quv2c
, lbe6tl 9
0
That was a typo. I can't remember what the question was, but I've been fiddling around with Debian Linux
and DNS stuff. I'm not going to master a language soon, may as well learn networks. I'd trade the ability to
to run fast(which I can btw) for C+ downloaded to you brain.
0
print has a return value of one (1), while echo
has zero (0) value and thus can be used in expressions.
Print is more common but echo more versatile.
I guess echo is for math teachers who wrote their own tests in Python. Who knows ?