View Single Post
  #7 (permalink)  
Old 10-15-2008, 11:01 PM
David Powers
 
Posts: n/a
Diggs:
Default Re: PHP Notice Problem

UteFanJason wrote:
> I'm looking
> at the isset() function and the question mark in David's line
>
> $search = isset($_GET['search']) ? $_GET['search'] : null;
>
> What are they and how do they work?


isset() tests whether a variable has been declared:

http://docs.php.net/manual/en/function.isset.php

The question mark followed by the colon (? is the conditional
(ternary) operator:

http://docs.php.net/manual/en/langua...comparison.php

The following line:

$search = isset($_GET['search']) ? $_GET['search'] : null;

has the same meaning as this:

if (isset($_GET['search'])) {
$search = $_GET['search'];
} else {
$search = null;
}

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Reply With Quote