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

 

Link to comment
Share on other sites

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!!!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.