oop - How can I tell if a function is being called statically in PHP? -


possible duplicate:
how tell whether i’m static or object?

let's have fooclass bar() method. inside of bar() method, there way tell if it's being called statically or not, can treat these 2 cases differently?

fooclass::bar(); $baz = new fooclass(); $baz->bar(); 

class fooclass {      function bar() {         if ( isset( $this ) && get_class($this) == __class__ ) {             echo "not static";         }         else {             echo "static";         }     }  }  fooclass::bar(); $baz = new fooclass(); $baz->bar(); 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -