print echo
Posted: Sun Jul 24, 2005 9:20 am
what is the difference between print and echo
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
echo
(PHP 3, PHP 4, PHP 5 )
echo -- Output one or more strings
Description
void echo ( string arg1 [, string ...] )
Outputs all parameters.
echo() is not actually a function (it is a language construct) so you are not required to use parentheses with it. In fact, if you want to pass more than one parameter to echo, you must not enclose the parameters within parentheses.
(PHP 3, PHP 4, PHP 5 )
print -- Output a string
Description
int print ( string arg )
Outputs arg. Returns 1, always.
print() is not actually a real function (it is a language construct) so you are not required to use parentheses with its argument list.
Code: Select all
<?php
$string1="Hello ";
$string2="world";
echo $string1,$string2;
print $string1 . $string2;
?>