PHP Statement | echo and Print


PHP Statement:

echo :

  • echo statement can be used without parenthesis and with parenthesis  [ echo or echo() ]
  • echo statement display on browser such as String, Numbers, Variable, Values, and result of  expression.
  • echo statement single cot ('  ') execution is fast as compared to double cot ("   ")  because "  " performed the additional task i.e find the instruction of variable string.
Example:


<!DOCTYPE html>
<html>
<head>
 <title>circuitcoder.com</title>
</head>
<body>
<?php
//Single lime comment 
# Single lime comment 
echo "Hi";
echo 'Hi';
echo ('Hi');
?>
</body>
</html>


print :
  • In print statement, we may not be use parenthesis  [ print() or print ]
  • Print statement can be used to print screen and variable.

Example:

<!DOCTYPE html>
<html>
<head>
 <title>circuitcoder.com</title>
</head>
<body>
<?php
//Single lime comment 
# Single lime comment 
print "Hi";
print 'Hi';
print ('Hi');
?>
</body>
</html>

Comments