ID: 20437 Updated by: [EMAIL PROTECTED] Reported By: rrobin at greenapple dot com -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Any PHP Version: 4.2.1 New Comment:
This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. I added a note with an example to the docs, which should clarify the behaviour of static vars when values are assigned to them. Previous Comments: ------------------------------------------------------------------------ [2002-11-15 18:19:09] [EMAIL PROTECTED] Any expression or function call, doesn't work with a static declaration. It's documented through the user notes at: http://www.php.net/manual/en/language.variables.scope.php posting by "tomek at pluton dot pl". It does IMO deserve proper documentation, because downloadable docs, don't contain the user notes. ------------------------------------------------------------------------ [2002-11-15 17:57:12] [EMAIL PROTECTED] hmm, not so sure if this is expected or a bug, Andi? Derick ------------------------------------------------------------------------ [2002-11-15 17:55:31] rrobin at greenapple dot com i am not in the class, the whole file contains only <?php static $m=1|2; ?> ------------------------------------------------------------------------ [2002-11-15 01:03:46] [EMAIL PROTECTED] >From http://www.php.net/manual/en/language.oop.php: Note: In PHP 4, only constant initializers for var variables are allowed. To initialize variables with non-constant values, you need an initialization function which is called automatically when an object is being constructed from the class. Such a function is called a constructor (see below). ------------------------------------------------------------------------ [2002-11-14 21:45:20] rrobin at greenapple dot com it seems that i cannot do static $m=1|2|4; getting rid of the static would compile it. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20437&edit=1 -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
