codegurukool.com · Free coding tutorials & online compiler

Home › PHP Tutorial › PHP echo and print

PHP echo and print

Send output to the page.

echo can take several values and has no return value. print takes one value and returns 1. Join strings with the dot operator. PHP_EOL is a line break.

Example code

<?php
echo "Hello", " ", "World", PHP_EOL;
print "print returns 1" . PHP_EOL;
$x = 5;
echo "x is " . $x . PHP_EOL;
?>

Run this code in the online editor

← PHP variablesPHP data types →