In PHP the two basic constructs to get output are echo and print.we covered in this topic both type echo and print the following with syntax and it's example.
echo() is not a function, it is a language construct therefore you can use it with and without parentheses for example echo and echo() the following synax and example of echo.
<?php
echo "This is Without Parentheses";
echo ("This is With Parentheses");
?>
print it is a language construct therefore you can use it with and without parentheses for example print and print() the following synax and example of print.
<?php
print "This is Without Parentheses";
print ("This is With Parentheses");
?>
Sr.No |
Echo |
|
---|---|---|
1 |
Echo is a statement i.e used to display the output. it can be used with parentheses echo or without parentheses echo. |
Print is a statement i.e used to display the output.it can be used with parentheses print( ) or without parentheses print. |
2 |
Echo can pass multiple string separated as ( , ) |
Using print can doesn’t pass multiple argument |
3 |
Echo doesn’t return any value |
Print always return 1 |
4 |
Echo is faster then print |
Print slower than echo |
are you understand above echo and print,read the next topic name datatype in php click on next button and read now.