php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5515 class has problems as a key in hashes
Submitted: 2000-07-11 14:25 UTC Modified: 2000-07-12 02:59 UTC
From: medwards at corestrategy dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.0 OS: Linux 2.2.16
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: medwards at corestrategy dot com
New email:
PHP Version: OS:

 

 [2000-07-11 14:25 UTC] medwards at corestrategy dot com
If I do:

<?=$bug_tracker[class]?>

PHP gives me a parse error saying it is looking for a "]" symbol.

If I do:

<?=$bug_tracker["class"]?>

it works as intended. I assume this is because class is a PHP reserved word? I still think the parser should be able to cope with this.

Let me know if I'm wrong,

thanks.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-12 02:59 UTC] stas at cvs dot php dot net
Yes you guessed right. "class" is a keyword in PHP.
Also, it is recommended to use quotes for strings anyway, be them reserved word or not.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 11:00:01 2026 UTC