note 53521 added to function.is-file

From: Date: Sat, 04 Jun 2005 17:03:02 +0000
Subject: note 53521 added to function.is-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-89920@lists.php.net to get a copy of this message
The following will "guess" if something is a file in case it is not availible. function isfile($page) { //get the top file/dir $file=basename($page); // ends in a slash, so is a dir if(substr($file,strlen($file)-1)=='/') { return false; } //find all dots $a=explode('.',$file); //there is a dot, means it is a file with a extension //beware of http://www.site.com if(count($a)>1) { return true; } else { return false } } ---- Manual Page -- http://www.php.net/manual/en/function.is-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53521 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53521&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53521&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53521&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53521&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53521&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53521&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89920) next »