note 60231 added to language.variables.scope

From: Date: Fri, 30 Dec 2005 17:07:42 +0000
Subject: note 60231 added to language.variables.scope
Groups: php.notes 
Request: Send a blank email to php-notes+get-100997@lists.php.net to get a copy of this message
Sometimes in PHP 4 you need static variabiles in class. You can do it by referencing static variable in constructor to the class variable: <?php class test { var $var; var $static_var; function test() { static $s; $this->static_var =& $s; } } $a=new test(); $a->static_var=4; $a->var=4; $b=new test(); echo $b->static_var; //this will output 4 echo $b->var; //this will output nul ?> ---- Manual Page -- http://www.php.net/manual/en/language.variables.scope.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60231 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60231&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60231&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60231&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60231&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60231&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60231&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60231&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60231&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100997) next »