I'm trying to figure out how am I supposed to write this snippet
properly:

  if (($index = array_search($search, array_keys($pages))) !== false) {
    echo "index: $index\n";
  } else {
    echo "Not found\n";
  }


 When I search for something that I know exists, it returns the $index
just fine.  However, when I search for something that does not exist, it
never tells me 'Not found', instead it just displays a blank index (it
looks like $index = "", not false).  Should I be checking it against
'false', or against "" ?

    Using PHP 4.0.7-dev.

--
W | I haven't lost my mind; it's backed up on tape somewhere.
  +--------------------------------------------------------------------
  Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
  IT Director / SysAdmin / WebSmith             .     800.441.3873 x130
  Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave. #6
  http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to