note 123884 added to function.file-exists
| From: | jag@php.net | Date: | Fri, 24 May 2019 23:00:24 +0000 |
| Subject: | note 123884 added to function.file-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-211116@lists.php.net to get a copy of this message | ||
file_exists() does NOT search the php include_path for your file, so don't use it before trying
to include or require.
use
@$result = include $filename;
Yes, include does return false when the file can't be found, but it does also generate a
warning. That's why you need the @. Don't try to get around the warning issue by using
file_exists(). That will leave you scratching your head until you figure out or stumble across the
fact that file_exists() DOESN'T SEARCH THE PHP INCLUDE_PATH.
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.157.34 (proxied: 207.243.116.241)
----
Manual Page -- http://php.net/manual/en/function.file-exists.php
Edit -- https://master.php.net/note/edit/123884
Del: integrated -- https://master.php.net/note/delete/123884/integrated
Del: useless -- https://master.php.net/note/delete/123884/useless
Del: bad code -- https://master.php.net/note/delete/123884/bad+code
Del: spam -- https://master.php.net/note/delete/123884/spam
Del: non-english -- https://master.php.net/note/delete/123884/non-english
Del: in docs -- https://master.php.net/note/delete/123884/in+docs
Del: other reasons-- https://master.php.net/note/delete/123884
Reject -- https://master.php.net/note/reject/123884
Search -- https://master.php.net/manage/user-notes.php