Why does echo function have two ways to use it?

advertisements

Lastly I was really wondering why in PHP I can use two ways to use echo function. First one:

<?php
echo ("Hello World!");
?>

And second:

<?php
echo "Hello World!";
?>

The second one makes no sense for me as from what I heard we pass function arguments within the brackets.


From the PHP manual:

echo() is not actually a function (it is a language construct), so you are not required to use parentheses with it. echo() (unlike some other language constructs) does not behave like a function, so it cannot always be used in the context of a function. Additionally, if you want to pass more than one parameter to echo(), the parameters must not be enclosed within parentheses.

http://www.php.net/echo