Re: substr?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Know what I found that works most reliably though?

$filenameExploded = explode(".", $filename);

that way, if I have a file like this: filename.todaysdate.todaystime.extension I don't end up with the extension being: .todaysdate.todaystime.extension :) Unless I was using the substr() command wrong.


On Jun 19, 2008, at 1:53 PM, Philip Thompson wrote:

Does that get a different result than mine?

~Phil


On Jun 19, 2008, at 10:44 AM, Daniel Brown wrote:

  Try this:

<?php

$filename = 'this_example.php.file.backup.phps';

echo substr($filename,(strrpos($filename,'.') + 1),strlen($filename))."\n";
?>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
japruim@xxxxxxxxxx





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux