InterviewSolution
Saved Bookmarks
| 1. |
List the differences between Echo and Print in PHP. |
|
Answer» The functions of echo and print are nearly identical. Both are used to display info on the screen. The differences are MINOR:
Example: <!DOCTYPE html><html><body><?phpprint "PHP is fun!<br>";echo "PHP is fun.<br>";echo "PHP ", "is ", "fun.";?> </body></html>Output: PHP is fun!PHP is fun.PHP is fun.The above example SHOWS that echo can take many parameters whereas print cannot. We obtain a syntax error if we try to pass multiple parameters into print. |
|