In PHP there is 2 ways to print output:
- echo
echo is bit faster compare with print.
echo can output one or more strings
print can only output one string, and it returns value as 1.
Echo
echo is a language construct, and can be used with or without parentheses: echo or echo().
<?php $txt = "test data"; echo $txt1; echo "$txt1"; echo '$txt1'; ?> Output: test data test data $txt1
If we use double quotes in echo statement, it will check both the variable data and string.
If we use single quotes in echo statement, it will consider all data as string only.