MasterA
Level 1
Write the reason you're deleting this FAQ
I am learning PHP at the moment and I have a question about printing outputs using PHP. I know the both “echo” and “print” displays an output.
For example:
echo “Hello World”;
print “Hello World”;
Are you sure you want to delete this post?
robertman11
- Print returns a value. The return value is always "1". This means it can be used in expressions. Example:
$myReturn = print "hello";
- Echo is faster. Not much, but it is since it doesn't return a value.
- Echo can take more than one parameter.
- Echo supports short syntax:
<?=$somevariable?>
Not much, they are essentially the same thing. Here are the key (minor) differences: [list=1][*]Print returns a value. The return value is always "1". This means it can be used in expressions. Example:[/*][code=php]$myReturn = print "hello";[/code] $myReturn will equal 1. [*]Echo is faster. Not much, but it is since it doesn't return a value.[/*][*]Echo can take more than one parameter.[/*][*]Echo supports short syntax:[/*][code=php]<?=$somevariable?>[/code] [/list]$myReturn will equal 1.
Are you sure you want to delete this post?