Skip to content

Instantly share code, notes, and snippets.

@gr4y
Created August 1, 2011 19:43
Show Gist options
  • Select an option

  • Save gr4y/1118836 to your computer and use it in GitHub Desktop.

Select an option

Save gr4y/1118836 to your computer and use it in GitHub Desktop.
/**
* That's why i hate PHP...
*/
private static function method_exists($array){
if(count($array) == 2) return method_exists($array[0], $array[1]);
else throw new Exception("method_exists needs an array with exactly 2 arguments");
}
/*
* Turns out, PHP has this method already. It is called 'is_callable'
* Thanks to @gigalinux
*/
is_callable($array);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment