sangoku Posted February 16, 2010 Share Posted February 16, 2010 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 ups. had 2 windows open typed in a wrong one can someone delete/move this massage. to php coding help Link to comment https://forums.phpfreaks.com/topic/192208-need-a-way-to-let-a-function-know-it-is-in-a-object/ Share on other sites More sharing options...
sangoku Posted February 16, 2010 Author Share Posted February 16, 2010 could i use get_called_class to find this out 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!!! Link to comment https://forums.phpfreaks.com/topic/192208-need-a-way-to-let-a-function-know-it-is-in-a-object/#findComment-1012912 Share on other sites More sharing options...
sangoku Posted February 16, 2010 Author Share Posted February 16, 2010 :'( found the solution it was so simple yet brilliant i just checked if $this was set XD if yes dont make new object Link to comment https://forums.phpfreaks.com/topic/192208-need-a-way-to-let-a-function-know-it-is-in-a-object/#findComment-1012921 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.