note 59644 deleted from function.is-file by googleguy

From: Date: Tue, 22 Oct 2013 14:55:02 +0000
Subject: note 59644 deleted from function.is-file by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197233@lists.php.net to get a copy of this message
Note Submitter: Emin Sadykhov (azdg_nospam at azdg dot com) ---- File operations such as is_file (also is_dir, opendir, readdir) work slower with Absolute paths - processing time is increase in 2-3 times. Current rule is actual only for PHP5 (tested on 5.0.4, 5.1.1, Windows and Linux, 1st and 2nd Apache) Try to use relative paths in these operators. Example tested on my machine: <?php # note: in the both conditions file really exists! # WIN XP, PHP4 # processing time: ~ 0.0003 sec. if(is_file("images/10.jpg")) echo 'file exists'; # processing time: ~ 0.0002 sec. !!! if(is_file("C:/server/htdocs/mysite/images/10.jpg")) echo 'file exists'; # WIN XP, PHP5 # processing time: ~ 0.0004 sec. if(is_file("images/10.jpg")) echo 'file exists'; # processing time: ~ 0.0010 sec. if(is_file("C:/server/htdocs/mysite/images/10.jpg")) echo 'file exists'; ?>

« previous php.notes (#197233) next »