Every so often I have to be using the isset() function to check if a variable 
exists. It would be useful to have something like an ifset() function

Instead of doing this

$v = isset($input) ? $input : $default;

we can do this

$v = ifset($input,$default); 
// returns $input if it exists otherwise it will return $default

We could also do the same for the empty() function. So instead of doing this

$v = empty($input) ? $default : $input;

we can do this

$v = ifempty($input,$default);
// returns $input if it is not empty otherwise it will return $default

What do you think? Can they make it into 5.3?

Best regards
Raymond Irving

Reply via email to