PHP get all function arguments as $key => $value array?

Posted by web lover on Stack Overflow See other posts from Stack Overflow or by web lover
Published on 2011-01-13T09:14:27Z Indexed on 2011/01/13 9:53 UTC
Read the original article Hit count: 183

Filed under:
<?php
function register_template(){
    print_r(func_get_args());
    # the result was an array ( [0] => my template [1] => screenshot.png [2] => nice template .. ) 

}

register_template(     # unkown number of arguments
    $name = "my template",
    $screenshot = "screenshot.png",
    $description = "nice template .. "
)
?>

BUT , I want the result array as $key => $value form , $key represents the parameter name.

© Stack Overflow or respective owner

Related posts about php