Language Constructs
Language constructs are things that the PHP parser already knows about. Some language constructs act like functions, while others are used to build control statements such as if
and while
. Language constructs that act like functions look very much like built-in functions in the way they are used. If you want to print a string, you can choose to use echo
, which is a language construct; or print
, which is also a language construct. There are small differences between echo
and print
, and echo
is the most commonly used. When comparing the two, echo
doesn't have a return value and has the option of multiple parameters, whereas print
returns a value that can be used in an expression and allows only one parameter. echo
is the most flexible of the two and is a tiny bit faster. Language constructs can be used with or without parentheses. In contrast, callables are always used with parentheses:
// echo is a language construct echo 'hello world'; // echo...