Override default php function

You can use namespaces to override existing function names:

namespace blarg;
function basename() {
  return 'whatever';
}
$base = basename();

I.e., any call to basename() within the blarg namespace will use your new version of the function.

Leave a Comment