Forum Moderators: coopster

Message Too Old, No Replies

What is the difference between echo and print?

         

tresmom5

3:40 am on Oct 9, 2004 (gmt 0)

10+ Year Member



I see them both used, but yet to figure out what the difference is. I have bought two books on php since I first posted on this site and feeling a little less confused. I see that there is a lot of different ways to do the same thing. Are echo and print the same thing or do they have different purposes?

Thanks,
Teresa

jatar_k

5:19 am on Oct 9, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



give this thread a try and see if it helps

Benchmarking PHP text output [webmasterworld.com]

Adrian2k4

7:10 am on Oct 9, 2004 (gmt 0)

10+ Year Member



echo is faster than print:
[dynacker.dotgeek.org...]

this is because print returns a int value and echo returns no value / a void value.

otherwise there is no difference between print and echo. if your splitting hairs considering scipt parsing speed then you should stick to echo.

best regards
adrian

tresmom5

12:52 pm on Oct 9, 2004 (gmt 0)

10+ Year Member



Thank you!