note 70815 deleted from function.pathinfo by nlopess

From: Date: Sun, 29 Oct 2006 20:29:34 +0000
Subject: note 70815 deleted from function.pathinfo by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119237@lists.php.net to get a copy of this message
Note Submitter: tzveeka at tzveeka dot com ---- if the file you're trying to get an extension from has variables attached to it like this one: jhonson.gif?xxx=1 use this to get the extension without the variables: // Creating a new file name using the file code: $path_parts = pathinfo($file_name); //Lowering all extensions to low caps! $extension = strtolower($path_parts['extension']); // if file has variables removing them from extension: if (!(strpos($extension, "?") === false)) { $extension = substr($extension,0, strpos($extension, "?")); }

« previous php.notes (#119237) next »