php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47454 provide a function to get caller scope
Submitted: 2009-02-19 22:28 UTC Modified: 2009-02-22 15:03 UTC
From: wesley dot gunn at email dot it Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5.3.0beta1 OS: irrelevant
Private report: No CVE-ID: None
 [2009-02-19 22:28 UTC] wesley dot gunn at email dot it
Description:
------------
hello,

i'm building a test/debug framework for my apps
i think can be useful a function that provides the caller scope of a certain function/method

thank you

Reproduce code:
---------------
namespace;
echo get_caller_scope(); // returns "\" global scope

namespace Test\A;
echo get_caller_scope(); // returns Test\A

class CallerTest
{
     public static function gimme(){echo get_caller_scope();}
     public static function launch(){self::test();}
}

Test::gimme(); // returns Test\A
Test::launch(); // returns Test\A\CallerTest


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-20 01:13 UTC] wesley dot gunn at email dot it
i'm sorry... resolved!

debug_backtrace();

i'm sorry!!!

thank you anyway!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC