note 40737 deleted from function.file-exists by aidan

From: Date: Sat, 18 Sep 2004 05:28:33 +0000
Subject: note 40737 deleted from function.file-exists by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-76930@lists.php.net to get a copy of this message
Note Submitter: tonio_lesec at yahoo dot fr ---- > your logic is backwards on your example did u just read his code ? > $return = strpos($arr_headers[0], "404") !== false; returns true when 404 is found on the return file headers, a "404 not found" ... this is a common way to write a function, returning 0 when it's all right and an error code otherwise. i guess the function name is fuzzy : remote_file_exists (yes, no) won't be logical check_file_access (0, errno) will but the example was correct : > if (remote_file_exists ($url)) /* if 404 is found on the web server response header */ > { print ($url . " file doesn't exists!"); } /* this url cannot be retrieved */ i hope i'll be understandable, im just a poor froggy :)

« previous php.notes (#76930) next »