I'm sure I'm not the first person to find strict checking of whether
or not variable (or array index) is set painful. I've considered
just setting error_reporting() to some lax level on every script I
write for the rest of my life, but have been thinking there might
be a better way.

What I'd like is a "sureset()" function ...there's probably a better 
name, but what it would do is more important:

function sureset($var) {

        if(!isset($var) || empty($var))
                return '';
        else
                return $var;
}

Of course, when you've got strict checking on, the above doesn't 
work, because if the variable is unset you get caught on the fact 
before the function call happens.

Is there something like this already? Is there a way to make this 
work? Or should I just go back to the idea of nuking error_reporting
in all my scripts?

Thanks,
        Weston


Thanks,

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to