note 11833 rejected from language.operators by didou
| From: | didou@php.net | Date: | Fri, 03 Oct 2003 11:32:59 +0000 |
| Subject: | note 11833 rejected from language.operators by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57706@lists.php.net to get a copy of this message | ||
Note Submitter: yasuo_ohgaki@hotmail.com
----
There are some operator descriptions missing. (I'm not sure what is considered as operator in
PHP, but anyway)
::
Scope resolution operator for class
->
Member selection operator for class
new
Object creation operator
?:
It is described in Comparison Operator Section. I think it worth to make a new sub section for
ternary operator.
[]
I think Array "[]" is considered as operator. It mentioned in Operator Precedence Section
as [, but no description. (Or is there any other use for single "["?)
()
Grouping expressions. It might not considered as operator in PHP, but it is better to be included at
least in Operator Precedence section.
{}
Resolve ambiguous reference to variables. For example, {} is needed to resolve
$array1['array_stored_as_array_element']['value']. {} is also needed to resolve
ambiguity such as echo " $array_3d[1][2][3] "
It might not considered as operator in PHP, but it is better to be included at least in Operator
Precedence section.
&
Reference operator. There is a section for reference, but it is better to be explained briefly in
this section and direct reader to Reference section.
(type)
Cast operator like (int)$v to get integer value. I suppose these are operators also. Mentioned in
Precedence section, but no description.
+= -= *= /= .= %= &= |= ^= ~= <<= >>=
Some assignment operators that are supported are not described. Mentioned in Precedence section,
though.
print
Looks like "print" is considered as operator in PHP. (I thought "echo" is) It
mentioned in Precedence section, but no description. Description for these may be helpful for
programmers to distinguish what is "expression" and what is not.
For some reason, PHP4.0.4pl1 dose not allow. (I posted as bug, I got reply "echo" is not
a valid expression. Therefore, PHP complained for following code as a parse error)
($val) ? echo('true') : echo('false');
but PHP does ALLOW
($val) ? print('true') : print('false');
($val) ? include('true.inc') : include('false.inc');
I'm confused with these. i.e. What is a expression, what is not an expression.
If there are other operators like "print" (maybe echo?), all of them should be described
or mentioned, at least, in this section. (I think it would be nice to have a section describing what
is statements/language construct)
It is not about operator, but it would be nice to have BNF of PHP (Zend Script Engine) as a
reference.