|  | Posted by Giovanni R. on 05/29/07 18:40 
gosha bine <stereofrog@gmail.com> wrote:
 > what exactly is the desired behaviour of that new, emulated isset?
 
 The fact is that I'm lazy. ;-)
 
 I'd like to use a single function - a kind of wrapper for isset() - to
 check whether the $var isset(), and to sanitize it according to my will.
 
 Something like this:
 
 function wrapper(&$var) {
 
 if ( !isset($var) || !strlen($var) ) return '';
 
 $var = trim ($var);
 
 // other checks
 
 return $var;
 
 }
 
 Here it is how it could be used:
 
 print wrapper($array['inexistent_index']);
 
 In this way, even if $array['inexistent_index'] isn't defined, I don't
 get a notice. The fact is that wrapper() adds that index to the array
 and sets $array['inexistent_index'] to NULL. :-(
 
 So I was asking myself how isset() works and if a similar function could
 be developed using PHP or not.
 
 Giovanni
  Navigation: [Reply to this message] |