title: PHP: How to realize event handler?
body: <p>I want to add custom event handler to object's method.</p>
  
  <p>I've got a class with method.</p>
  
  <pre><code>class Post {
  
      public function Add($title) {
  
          // beforeAdd event should be called here
  
          echo 'Post "' . $title . '" added.';
          return;
      }
  }
  </code></pre>
  
  <p>I want to add an event to method <code>Add</code> and pass method's argument(s) to the event handler.</p>
  
  <pre><code>function AddEventHandler($event, $handler){
      // What should this function do?
  }
  
  $handler = function($title){
      return strtoupper($title);
  }
  
  AddEventHandler('beforeAdd', $handler);
  </code></pre>
  
  <p>Is it possible to do something like this? Hope my question is clear.</p>