How can I convert a PHP function's parameter list to an associative array?
问题 I want to convert the arguments to a function into an associative array with keys equal to the parameter variable names, and values equal to the parameter values. PHP: function my_function($a, $b, $c) { // <--- magic goes here to create the $params array var_dump($params['a'] === $a); // Should result in bool(true) var_dump($params['b'] === $b); // Should result in bool(true) var_dump($params['c'] === $c); // Should result in bool(true) } How can I do this? 回答1: The you can do this using