[Lvlug] PHP Test foir Variable
Caleb Shay
caleb at webninja.com
Thu Dec 22 10:00:14 EST 2005
Oh, in this case you could also use:
if (array_key_exists('bar',$_REQUEST)) {
// whatever action
}
The difference is that if $_REQUEST['bar'] == null (as in, it has been
set, but the value is null) then array_key_exists will still return
true, while isset will return false.
PHP easily has the best online documentation of any language I've ever
had to use. http://www.php.net/<whatever you are looking for> will
either give you the documentation on the function or do a search for
whatever you are looking for in the docs.
Cheers,
Caleb
On Thu, 2005-12-22 at 09:54 -0500, Caleb Shay wrote:
> if (isset($_REQUEST['bar'])) {
> // whatever action
> }
>
> Cheers,
>
> Caleb
>
> On Thu, 2005-12-22 at 06:33 -0500, Paul Ryan wrote:
> > Holiday Greetings, All.
> >
> > I'm doing a happy dance having finally gotten Apache 2.2, MySQL 4.1.14, PHP
> > 4.4.1 and SSL running under Slack 10.2. When one stays on older versions too
> > long, the move up to "current" can be painful!
> >
> > My question today concerns PHP. Is there a way to test for the existence of
> > an item in the query string without actually equating the item. For
> > instance:
> > $foo = $_POST['bar'];
> > or
> > $foo = $_REQUEST['bar]';
> > will both generate errors if bar was not defined in the calling FORM document.
> > I would think there would be something like "if_exists" or "if_defined" or
> > "exists" but I couldn't find it in my manual search. Oh, that's another
> > thing, as the version numbers grow, so does the size of the manuals!
> >
> > :)
> > Paul
> >
> >
> > _______________________________________________
> > Lvlug mailing list
> > Lvlug at thelinuxlink.net
> > https://www.thelinuxlink.net/mailman/listinfo/lvlug
>
> _______________________________________________
> Lvlug mailing list
> Lvlug at thelinuxlink.net
> https://www.thelinuxlink.net/mailman/listinfo/lvlug
More information about the Lvlug
mailing list