title: Is there a way to override/rename/remap function in php?
body: <p>I know it's possible in other language like C++ or Obj-c even (at runtime AND compile time) but is there a way to override/rename/remap function in php? So what I mean is, let's say we want to replace the implementation of mysql_query. Is that possible?</p>
  
  <pre><code>SOME_REMAP_FUNCTION(mysql_query, new_mysql_query);
  
  //and then you define your new function
  function new_mysql_query(blah...) {
    //do something custom here
    //then call the original mysql_query
    mysql_query(blah...)
  }
  </code></pre>
  
  <p><strong>This way the rest of the code can transparently call the mysql_query function and not know that we inserted some custom code in the middle.</strong></p>