title: NOT instanceof: object NOT belonging to a class
body: <p>I saw that &quot;instanceof&quot; does not accept negation with the exclamation point (&quot;!instanceof&quot;).
  To check if an object does not belong to a class, what is the best way to get the same result as the following NOT valid code?</p>
  <pre><code>class foo {
     // properties and methods
  }
  
  if ($abc !instanceof foo) {
       $abc = new foo;
  }
  </code></pre>