The question already answers. PHP is a language without much criteria. It was created by those who do not understand language theory and are doing it in need (nor can you speak in intuitiveness because the intuitive is the standard). And whoever creates the language can do it any way they want, even without having to explain it to anyone because it was done that way, even though it makes the language lose credibility among good development professionals.
We can see echo
in two ways: a language construct, since it accepts unrelated, so it is special, it is not a common function; or we can see how a function, which is inherently an expression always, and the documentation helps to refer to this thesis , even if it indicates that it is not. In the end there was a confusion between one thing and another. Because it always results in void
it makes little sense to use echo
as an expression.
And what you pass as a parameter can be any expression that can be converted to type string .
Whether or not you can have parentheses is a decision of the creator of language. I would make this a common function with binding of them. But if I really want to be a language construct, I would not allow it to be used under normal conditions to make it clear that it is a construct, not a function, although it is somewhat complicated but not impossible to forbid the parentheses of an expression like any other.
It is not clear what these relatives refer to, and in practice it does not matter, but I would say that they are part of the construction and not an expression, even because in expressions the parentheses in such cases are unnecessary, then it would not make sense to document. But again, it is speculation of someone who studies languages. At least in the first example. In the second it is clearly of expression, because the parentheses of the construction can only contain every expression to be echoed, the fact of having 2 removes the ambiguity of the interpretation.
The construct accepts commas because it was defined that it would accept. It makes sense can have multiple expressions and it handle it and coar all.