View Full Version : Print or Echo?


Xiphias
04-21-2003, 09:24 PM
for all those PHP ppl, which do you prefer - echo or print?

toosweet4u
04-21-2003, 10:32 PM
I use echo(), because its a little faster than print(). A few seconds could make alot of difference. :)

Jasper
04-22-2003, 05:28 AM
^^^^^^^^^^^^^^^^^^^^^^^
same

thewwfc
04-22-2003, 06:53 AM
Echo() is just that bit faster :D

pb&j
04-23-2003, 03:25 AM
echo
it just looks cooler :D

Ökii
04-23-2003, 01:18 PM
I use echo unless I need a reference returned upon completion - the main real difference between the two is that print will return a value if attributed to a variable, where as echo will not.

$a = print('string');
echo $a;

should output 'string1'

echo can also output multiple strings delimited as a comma seperated array -- echo ($a, $b, $c); whereas print cannot.

also, what about printf() for formatted output and flush()/ob_end_flush() to send contents of a buffer to the browser and print_r() / var_dump() / var_export() for outputting arrays?

Xiphias
04-23-2003, 09:22 PM
Okii, you lost me after the first two lines...

alkaline39
04-24-2003, 01:38 AM
i use echo, habitual thing from the book i bought, they programmed everythign with echo