Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7788 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6594 invoked by uid 1010); 12 Feb 2004 20:31:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 6501 invoked from network); 12 Feb 2004 20:31:39 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 12 Feb 2004 20:31:39 -0000 Received: (qmail 25866 invoked from network); 12 Feb 2004 20:31:37 -0000 Received: from guardian.zend.office (HELO andi-laptop.zend.com) (10.1.1.4) by int.zend.com with SMTP; 12 Feb 2004 20:31:37 -0000 Message-ID: <5.1.0.14.2.20040212222732.02bbd808@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 12 Feb 2004 22:31:34 +0200 To: zhundiak@comcast.net,internals@lists.php.net In-Reply-To: <021220041948.3465.5df8@comcast.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Static class variables and $this From: andi@zend.com (Andi Gutmans) References: <021220041948.3465.5df8@comcast.net> Use self::$cnt but internals@ is not meant for PHP questions but for discussing development of PHP. Andi At 07:48 PM 2/12/2004 +0000, zhundiak@comcast.net wrote: >Can someone point me to some more information on using PHP 5's static >class variables? All I have been able to find is the zend php5 changes page. >Consider: >error_reporting(E_ALL | E_STRICT); >class foo >{ > static $cnt = 0; > function getCnt1() { return $this->cnt; } // Does not work, undefined > variable > function getCnt2() { return foo:$cnt; } // Works as expected >} >$obj = new foo(); >echo $obj->getCnt1(); > >It seems that I should be able to access static class variables from >inside of created objects using $this. >Tested with php5b3. > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php