I want get name and value of function parameters by ..$arg
or func_get_args()
I don't want use compact
function and args_with_keys
not correct work
I tried debug_backtrace()[0]['args']
and get_defined_vars()
but It didn't work
$color = 'blue';
$size = '40cm';
function data(){
print_r(func_get_args());
}
data($color,$size); //array("color"=>"blue","size"=>"40cm")
OR
$color = 'blue';
$width = '40cm';
$height = '50cm';
function data(...$args){
print_r($args);
}
data($color,$size); //array("color"=>"blue","width"=>"40cm","height"=>"50cm")
I tried this But get me numeric key of arguments but I want get parameters name and value like above example
Thank You