title: Prototypal inheritance in PHP (like in JavaScript)
body: <p>Is it possible to employ some kind of <strong>prototypal inheritance in PHP</strong> like it is implemented in <strong>JavaScript</strong>?</p>
  
  <p>This question came to my mind just out of curiosity, not that I have to implement such thing and go against classical inheritance. It just feels like a interesting area to explore.</p>
  
  <p>Are there prebuild functions to <strong>combine classical inheritance model</strong> in PHP with some sort of <strong>Prototypal inheritance</strong> with a combination of anonymous functions?</p>
  
  <p>Let's say I have a simple class for UserModel</p>
  
  <pre><code>class UserModel implements PrototypalInheritance
  {
      // setters, getters, logic..
      static public function Prototype () {}
  }
  
  $user = new UserModel();
  
  UserModel::prototype()-&gt;getNameSlug = function () {
      return slugify($this-&gt;getUserName());
  }
  
  echo $user-&gt;getNameSlug();
  </code></pre>