I want to convert function string argument into array. so if I set 'user'
than eventually in function I want to convert it to $user
as soon as function start.
function
function get_item($object, $key)
{
//I want to convert 'user' string in '$user' variable
echo empty($object->$key) ? 'do_stuffs' : 'dont_do_stuffs';
}
usage
get_item('user', 'id');
I have tried something like
function get_item($object, $key)
{
$$object = $object //this is not working
echo empty($object->$key) ? 'do_stuffs' : 'dont_do_stuffs';
}