clock  Mon - Sun 8.00 AM - 8.00 PM
mail  edu@teknowize.com
fb
instagram
play store
pinterest

More

PHP echo and print Statements

Imperial Advance Hero Image

PHP echo and print Statements

  • Echo and print both are almost same, which is used to get output.
  • The echo statement can be used with parentheses: echo() or without parentheses: echo.
  • The print statement can be used with parentheses: print() or without parentheses: print.

 

There are two different methods to get output in PHP

  • echo or echo( )
  • print or print( )

 

Example

<!DOCTYPE html>
<head>
  <title>Document</title>
</head>

<body> 

<?php
print"This is print statement.<br>";
echo"This is echo statement.<br>";
print("This is print statement. <br>");
echo("This is echo statement.<br>");
?>

</body>

</html>

 

Output

php echo and print statement

PHP