echo and print are used in PHP to output text, variables, and HTML to the browser.
<?php
echo "Hello World!"; // Output using echo
echo "This ", "is ", "PHP."; // echo can output multiple strings
print "Hello PHP!"; // Output using print
$result = print "Test"; // print returns 1
?>
👉 Explanation:
echo → Faster, can output multiple values, does not return anything.print → Outputs one value at a time and always returns 1.