In this tutorial, you shall learn the difference between echo() and print() functions in PHP, with example programs.
PHP echo vs print
PHP print() prints only a single string, while echo() can print one or more strings to output.
The syntax of print() is
</>
Copy
print(string $expression): int
The syntax of echo is
</>
Copy
echo(string ...$expressions): void
Examples
1. Print
In the following example, we print a string "Hello World" to output using print().
PHP Program
</>
Copy
<?php
print("Hello World");
?>
Output
