PHP echo Statement

PHP echo statement can output one or more strings. PHP echo statement can be used to print the variable, string, multi-line strings, escaping characters etc.

echo does not need parenthesis although you can use the parenthesis if you want.

    echo "<h2>This is PHP Tutorial !</h2>";
    echo "Hello world!<br>";
    echo "I'm about to learn PHP!<br>";
    echo ("I am enclosed in parenthesis");

PHP print Statement

echo and print are both statement works exactly the same way except that the print statement can only output one string, and always returns 1. That is why the echo statement considered marginally faster than the print statement since it does not return any value.

    print "<h2>This is PHP Tutorial!</h2>";
    print "Hello world!<br>";
    print "I'm about to learn PHP!";
    print ("I am enclosed in parenthesis");