+91 9952732367

PHP echo and print statement

5. PHP echo and print statement

echo() and print() are not functions but language constructs in PHP. They are both used to output strings and there are very minor differences between echo and print in PHP.

echo() statement:

  • echo can take more than one parameter when used without parentheses. The syntax is echo expression [, expression[,expression] … ]. Note that echo ($arg1,$arg2) is invalid.
  • echo does not return any value.


  • void echo ( string $arg1 [, string $… ] )

print() statement:

  • print only takes one parameter.
  • print always returns 1 (integer)
  • int print ( string $arg )
  • In PHP, print is not a really function but a language construct. However, it behaves like a function in that it returns a value.


  • int print ( string $arg )
echo "String1", "String2", " String3";
print "Learn PHP at $str";
Copyright © s3learn.com