echo and print are quite similar, as both are used to output data to the screen.
The differences are minor: echo has no return value, while print returns 1, allowing it to be used in expressions. echo can accept multiple parameters (though this is uncommon), whereas print can take only one argument. Additionally, echo is slightly faster than print.
The echo statement can be used with or without parentheses: echo or echo().
echo |
The following example demonstrates how to output text using the echo
command (note that the text can include HTML markup):
echo |
The following example illustrates how to output text and variables using the echo statement:
$txt1
|