Reserved words are case-insensitive.

Bug #386830 reported by Jesdisciple
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: php5

Ubuntu 9.04
PHP 5.2.6-3ubuntu4.1

At the least, this is a documentation bug; I consider the behavior undesirable, so it's also a feature request. I was told to report bugs to Ubuntu rather than PHP; if this is incorrect, I'll take it upstream myself.

I learned the below function name in other languages where it's allowed, although I'm not certain whether this is because keywords are case-sensitive or because foreach isn't a keyword there.

function forEach(){
}

I expect this to be valid, but PHP says otherwise:
Parse error: syntax error, unexpected T_FOREACH, expecting T_STRING

The manual doesn't mention this that I can find ( http://www.php.net/manual/en/reserved.keywords.php ).

Revision history for this message
Ondřej Surý (ondrej) wrote :

From http://us2.php.net/manual/en/functions.user-defined.php
Note: Function names are case-insensitive, though it is usually good form to call functions as they appear in their declaration.

Changed in php5 (Ubuntu):
status: New → Invalid
Revision history for this message
Jesdisciple (jesdisciple) wrote :

Grr, it would be where I didn't think to check. Sorry. Now I'm curious why that behavior was selected.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.