PHP comes with hundreds of ready-made, built-in functions, making
it a very rich language. To use a function, call it by name. For
example, you can see the
print("print is a function");
The parentheses tell PHP that you’re referring to a function. Otherwise, it thinks you’re referring to a constant. You may see a warning such as this:
Notice: Use of undefined constant fname - assumed 'fname'
followed by the text string
fname, under the assumption that you must have
wanted to put a literal string in your code. (Things are even more
confusing if there is actually a constant named
fname, in which case PHP uses its
print "print doesn't require parentheses";
You do have to put parentheses after any other function you call, even if they’re empty (that is, if you’re not passing any argument to the function).
Functions can take any number of arguments, including zero. For
phpinfo, as shown here,
displays lots of information about the current installation of PHP and
requires no argument. The result of calling this function can be seen in
Figure 5-1. The output of PHP’s built-in phpinfo function
phpinfo function is extremely useful for obtaining information about your ...