Skip to content

Instantly share code, notes, and snippets.

@mihasya
Created December 17, 2008 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mihasya/37177 to your computer and use it in GitHub Desktop.
Save mihasya/37177 to your computer and use it in GitHub Desktop.
<?php
$argsToPass = array();
$args = ReflectionMethod->getParams();
/*you got an array of param names in the order they appear in the method signature */
foreach ($args as $arg) {
if (!isset($_REQUEST[$arg])) { //check if the arg is optional and fail if not }
$argsToPass[] = $_REQUEST[$arg];
}
$ReflectionMethod->invoke($argsToPass);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment