Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14357 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33751 invoked by uid 1010); 12 Jan 2005 15:58:07 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 33380 invoked by uid 1007); 12 Jan 2005 15:57:51 -0000 Message-ID: <20050112155751.33379.qmail@pb1.pair.com> To: internals@lists.php.net Date: Wed, 12 Jan 2005 16:58:20 +0100 Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Posted-By: 217.224.238.209 Subject: Get name of extending class with static method call (PHP5) From: roehr@zilleon.com ("Torsten Roehr") Hi devs, after a long discussion on php-general [1], searching the archives and trying every proposed solution without success I'm asking for your help to solve the following problem: class Car { function drive() { // I need the name of the calling class here // in my case it should be 'Porsche' } } class Porsche extends Car { } Porsche::drive(); With PHP4 it was possible to get the correct class name with debug_backtrace(). This behaviour has been changed in PHP5. How can I get the name of the extending class that invoked the method in drive()? Thanks in advance! Best regards, Torsten Roehr [1] http://marc.theaimsgroup.com/?t=110546013200009&r=1&w=2 (following the thread with a news client might be easier)