home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomePHP CookbookSearch this book

6.10. Returning Failure

6.10.2. Solution

Return false:

function lookup($name) {
    if (empty($name)) { return false; }
    ...
}

if (false !== lookup($name)) { /* act upon lookup */ }

6.10.4. See Also

The introduction to Chapter 5 for more on the truth values of variables; documentation on strpos( ) at http://www.php.net/strpos and empty( ) at http://www.php.net/empty; information on migrating from PHP 3 to PHP 4 at http://www.php.net/migration4.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.