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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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