Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7786 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26888 invoked by uid 1010); 12 Feb 2004 19:48:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 26854 invoked from network); 12 Feb 2004 19:48:51 -0000 Received: from unknown (HELO sccrmhc12.comcast.net) (204.127.202.56) by pb1.pair.com with SMTP; 12 Feb 2004 19:48:51 -0000 Received: from 204.127.205.143 ([204.127.205.143]) by comcast.net (sccrmhc12) with SMTP id <2004021219485001200st0t2e>; Thu, 12 Feb 2004 19:48:50 +0000 Received: from [65.208.22.25] by 204.127.205.143; Thu, 12 Feb 2004 19:48:50 +0000 To: internals@lists.php.net, Date: Thu, 12 Feb 2004 19:48:50 +0000 Message-ID: <021220041948.3465.5df8@comcast.net> X-Mailer: AT&T Message Center Version 1 (Oct 27 2003) X-Authenticated-Sender: emh1bmRpYWtAY29tY2FzdC5uZXQ= Subject: Static class variables and $this From: zhundiak@comcast.net 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.