Jump to content

need a way to let a function know it is in a object


sangoku

Recommended Posts

Hy as told i need a way to to let a class function know if i is either called before any object is made, eg. in a static function or inside a object. pls can someone help me out :P

 

ups. had 2 windows open typed in a wrong one can someone delete/move this massage.

to php coding help

 

could i use get_called_class to find this out :confused: because it says in help

 

Returns the class name. Returns FALSE if called from outside a class. 

 

duos it mean if it is called inside a class it will always turn true even if is called over a static function??? il hack it now...

 

 

edit:

 

damn it dous..... what now....

when you call it like

 

class a{

    static function b(){

        return get_called_class() ;

    }

}

$a = a::b();

 

you get a......... AAAaaaa!!!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.