You are here: Re: How to emulate isset() ? (is it possible?) « PHP Programming Language « IT news, forums, messages
Re: How to emulate isset() ? (is it possible?)

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация