Find a better logic to remove duplicated code from two different methods
Short version: Use a parameter!

public function handleOperation($action) {}
public function register() { $this-&gt;handleOperation("register"); }
public function unregister() { $this-&gt;handleOperation("unregister"); }




Slightly longer version: Don't be a smartass

You don't need to dynamically call spl_autoload_$function, it's pointless and unreadable. Just call spl_autoload_registerand spl_autoload_unregisterwhen you need it. It's unlikely for the function names to change.