How do I check in PHP that I’m in a static context (or not)?

Try the following:

class Foo {
   function bar() {
      $static = !(isset($this) && $this instanceof self);
   }
}

Source: seancoates.com via Google

Leave a Comment