|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-09 17:28 UTC] sniper@php.net
[2003-08-04 03:33 UTC] zeev@php.net
[2003-08-05 10:23 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 07:00:01 2025 UTC |
Description: ------------ The new per-class constants, introduced in PHP 5, don't allow to access array indizes. If I define an array as a constant of a class and try to access the first index of this constant for example, the Zend Engine 2 gives a parse error. Only index access on a variable, that points to this constant, works. Reproduce code: --------------- Class Example { const CATEGORIES = array('a', 'b'); } $c=Example::CATEGORIES; echo $c[0] . "\n"; echo Example::CATEGORIES[1] . "\n"; Expected result: ---------------- a b Actual result: -------------- PHP Parse error: parse error, unexpected '[' in example.php on line 8