Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28277 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24295 invoked by uid 1010); 6 Mar 2007 22:22:11 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 24279 invoked from network); 6 Mar 2007 22:22:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Mar 2007 22:22:10 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain php.net from 85.214.94.56 cause and error) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Received: from [85.214.94.56] ([85.214.94.56:33706] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 93/5E-01924-199EDE54 for ; Tue, 06 Mar 2007 17:22:09 -0500 Received: from [192.168.1.3] (dslb-084-063-042-230.pools.arcor-ip.net [84.63.42.230]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 823361B350E; Tue, 6 Mar 2007 23:22:06 +0100 (CET) Date: Tue, 6 Mar 2007 23:20:05 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1038359601.20070306232005@marcus-boerger.de> To: Etienne Kneuss CC: internals@lists.php.net In-Reply-To: <45ED838F.9040508@php.net> References: <45ED838F.9040508@php.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [patch] Dynamic access of static members/methods, and constants From: helly@php.net (Marcus Boerger) Hello Etienne, besides a tiny bit of whitespace issues the patch looks fine. Actually we use tabs at the beginning of lines here (prior and after |'s). Once you got more people looking/commenting on the patch we mde decide whetehr to apply it. best regards marcus Tuesday, March 6, 2007, 4:06:55 PM, you wrote: > Hi, > It may have already been proposed, but I give it a shot: > I believe it would be nice to be able to dynamically reference static > members and constants. > Currently, there is no way to do that and the only way would be to > create a static method and use call_user_func(array($classname, 'getThat')); > In other words: > class A { > public static $foo = 'bar'; > const gee = 'zzz'; > public static function getFoo() { return self::$foo; } > } > $classname = 'A'; > echo $classname::$foo; // bar > echo $classname::gee; // zzz > // instead of: > echo call_user_func(array($classname, 'getFoo')); > Please take a look at the patch I made for it. > For consistency purposes, I also implemented $classname::myMethod(); > even if it's not required. FWIW, I've no strong feeling about it. > Regards, Best regards, Marcus