Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17362 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67861 invoked by uid 1010); 21 Jul 2005 16:07:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 67846 invoked from network); 21 Jul 2005 16:07:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jul 2005 16:07:41 -0000 X-Host-Fingerprint: 84.148.162.194 p5494A2C2.dip0.t-ipconnect.de Received: from ([84.148.162.194:1396] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6227M)) with SMTP id F7/D0-33635-D48CFD24 for ; Thu, 21 Jul 2005 12:07:41 -0400 Message-ID: To: internals@lists.php.net Date: Thu, 21 Jul 2005 18:11:51 +0200 User-Agent: Thunderbird 1.0+ (Windows/20050719) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Posted-By: 84.148.162.194 Subject: $this availability inside static-functions From: lists@sebastianmendel.de (Sebastian Mendel) Hi, at first, im really really sorry to bother the internals-list with this problem (especially Derick for coming back from playing somewhere else ... () ), but i didnt find an answer on php.general or german php mailinglist if anybody just can point me to any discussions, websites, bugs or anything else related to the problem below. or just what is the point behind this behaviour? *PHP 4* how can i check if a method is called statically when called from inside another object? (without debug_bactrace()) class foo { function bar() { if ( isset( $this ) ) { return 'not static'; } return 'static'; } function bar2() { foo::bar(); } } // returns 'static' echo foo::bar(); // returns 'not static' but should be 'static' $foo = new foo; echo $foo->bar2(); *PHP 5* and btw. does anyone know why it is not good to let one function handle both methods of calling (static and not static) as in PHP 5 you will get notices if called wrong - but PHP doesnt support multiple function-definitions like: class foo { static function bar() { return ANY_DEFAULT_VALUE; } function bar() { return $this->value; } } or class foo { static function bar( $param ) { return $param; } function bar() { return $this->param; } } -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet