+ 1
why don't we write parenthesis inside of an echo function in PHP?
Php
2 Antworten
+ 3
since echo is not a function, we do not use parenthesis when calling it.
example:
echo "hello";
as opposed to
echo ("hello");
If it were to be a function, it would have been forced to be called as echo ("hello");
In ASP/Vbscript, I can call a function one of the following ways;
call dosomething("x","y","z") dosomething "x","y","z" notice the missing parathesis
The closest thing I have seen to this parenthesis-free syntax in PHP is the echo. I like the ability to skip the parenthesis.
My question to you is if there is a way to write a function in PHP, that would not require the use of the parenthesis?
0
Arun Kunj can you give an example, please?