difference between echo and print in php

Echo
The simplest use of echo is to print a string as argument, for example:
echo “This will print in the user’s browser window.”;
Or equivalently:
echo(“This will print in the user’s browser window.”);

Both of these statements will cause the given sentence to be displayed, without displaying
the quote signs. (Note for C programmers: Think of the HTTP connection to the user as the
standard output stream for these functions.)
You can also give multiple arguments to the unparenthesized version of echo, separated by
commas, as in:
echo “This will print in the “, “user’s browser window.”;
The parenthesized version, however, will not accept multiple arguments:
echo (“This will produce a “, “PARSE ERROR!”);
Print
The command print is very similar to echo, with two important differences:
✦ Unlike echo, print can accept only one argument.
✦ Unlike echo, print returns a value, which represents whether the print statement succeeded.

The value returned by print will be 1 if the printing was successful and 0 if unsuccessful.

posted @ 2010-03-01 13:06  looping  阅读(236)  评论(0编辑  收藏  举报