note 71537 added to function.file-exists
| From: | vivango at cs dot vu dot nl | Date: | Mon, 04 Dec 2006 23:15:51 +0000 |
| Subject: | note 71537 added to function.file-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120283@lists.php.net to get a copy of this message | ||
"if ($handle === false)"
should be
"if ($handle == false)"
---
User Contributed Notes
file_exists
29-Nov-2006 04:35
Don't use this function in loops as it's pretty slow:
leibwaechter at web dot de
<?php
function url_exists($url)
{
$handle = @fopen($url, "r");
if ($handle === false)
return false;
fclose($handle);
return true;
}
?>
Best in situations where it is a one off. Better still try to do without it. Checking lots of
addresses with this involves lots of dns lookups etc
----
Server IP: 83.137.20.120
Probable Submitter: 213.84.239.45
----
Manual Page -- http://www.php.net/manual/en/function.file-exists.php
Edit -- https://master.php.net/note/edit/71537
Del: integrated -- https://master.php.net/note/delete/71537/integrated
Del: useless -- https://master.php.net/note/delete/71537/useless
Del: bad code -- https://master.php.net/note/delete/71537/bad+code
Del: spam -- https://master.php.net/note/delete/71537/spam
Del: non-english -- https://master.php.net/note/delete/71537/non-english
Del: in docs -- https://master.php.net/note/delete/71537/in+docs
Del: other reasons-- https://master.php.net/note/delete/71537
Reject -- https://master.php.net/note/reject/71537
Search -- https://master.php.net/manage/user-notes.php