Two very useful PHP functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux