Echo and Print in php

Both the print and echo are used in the php to print strings and variables.The print can be enclosed with a parentheses or without a parantheses.But the echo doesn't uses a parantheses because it doesnot behaves like a function. The end of the echo is determined by a semicolon(;).

The main difference between the echo and print statements is that print statement can only print a single string while the echo statement can print one or more than one string. That is why echo is most commonly used than the print statement.

eg:

<?php echo "Multiple ","argument ","string!"; ?>

<?php print "Hello, world!"; ?>


Prev
Next

Comments

Popular posts from this blog

Node.js Cheat Sheet

Enhancing Supply Chain Security and Cloud-Native Development with Chainguard

Bootstrap ? What is it ?