Re: Re: what's the difference in the following code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Wrong. They are equivalent. The second is probably just easier to follow
> with a clearly defined default value outside the conditional block.

Well, leaving out the default value at the 2nd if statement makes a
difference and that's what I did.
Here is the code I changed again ..

Set to $_GET['search'] or an empty string
<?php
$search = isset($_GET['search']) ? $_GET['search'] : '';
?>

Only set if there is a $_GET['search']
<?php
// no default value <<<
if (isset($_GET['search'])) $search = $_GET['search'];
?>

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux