PHP Print

print - Output a string

print only accepts a single argument and always returns 1. it can be used with or without parentheses: print or print().

print is marginally slower than echo.

print is not actually a real function (it is a language construct) so you are not required to use parentheses with its argument list.

The major differences to echo are that print only accepts a single argument and always returns 1.

Below the syntax of PHP print

  int print  ( string $arg  )

Print a String

<?php  
   print "Hello World!"; // Outpul Hello World! 
?>

Print a variable value

<?php  
  $msg= "Hello World!"; 
  print "message is : $msg"; // Output  message is : Hello World! 
?>

Print escaping characters

<?php  
 print "Hello \"World!\"; // Output  Hello World!
 ?>