note 85420 modified in function.substr by danbrown

From: Date: Fri, 28 Nov 2008 20:11:12 +0000
Subject: note 85420 modified in function.substr by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-147186@lists.php.net to get a copy of this message
***Caution newbie*** To extract a file Extension this fuction could be useful. <?php $file_extension = substr($filename , strrpos($filename , '. ') +1); ?> Suppose your file name is Baldaris.jpeg strrpos will return the last dot position in the string 9 so so the compiler will execute substr($filename , 10) $file_extension will have value jpeg pretty cool... Cheer's Baldaris --was-- ***Caution newbie*** To extract a file Extension this fuction could be useful. $file_extension = substr($filename , strrpos($filename , '. ') +1); Suppose your file name is Baldaris.jpeg strrpos will return the last dot position in the string 9 so so the compiler will execute substr($filename , 10) $file_extension will have value jpeg pretty cool... Cheer's Baldaris http://php.net/manual/en/function.substr.php

« previous php.notes (#147186) next »