#20437 [Opn]: static $m=1|2;

From: Date: Sat, 16 Nov 2002 00:19:10 +0000
Subject: #20437 [Opn]: static $m=1|2;
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969349706@lists.php.net to get a copy of this message
ID: 20437 Updated by: msopacua@php.net Reported By: rrobin@greenapple.com Status: Open -Bug Type: Scripting Engine problem +Bug Type: Documentation problem -Operating System: BSDI +Operating System: Any PHP Version: 4.2.1 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2002-11-15 17:57:12] derick@php.net hmm, not so sure if this is expected or a bug, Andi? Derick ------------------------------------------------------------------------ [2002-11-15 17:55:31] rrobin@greenapple.com i am not in the class, the whole file contains only <?php static $m=1|2; ?> ------------------------------------------------------------------------ [2002-11-15 01:03:46] derick@php.net 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@greenapple.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

« previous php.doc (#969349706) next »