Thanks robin, this is very useful!
Robin Vickery wrote:
[EMAIL PROTECTED] (Mike Gifford) writes:
Hello,
I'm trying to replace a couple of lines of code:
$dotpos = 1 - (strlen($userfile_name) - strpos($userfile_name, '.'));
$extension = substr($userfile_name, $dotpos);
with a
Thanks..
_lallous wrote:
?
$str = /home/mike/test.txt;
if (preg_match(/[^\.]+$/, $str, $matches))
$ext = $matches[0];
else
$ext = no extension;
echo extension=$ext;
?
Mike Gifford [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hello,
I'm trying
On Mon, 10 Sep 2001, Mike Gifford wrote:
Thanks robin, this is very useful!
yep, although pathinfo() is much easier:
$extension = pathinfo($userfile_name, PATHINFO_EXTENSION);
-Sterling
Robin Vickery wrote:
[EMAIL PROTECTED] (Mike Gifford) writes:
Hello,
I'm trying to
?
$str = /home/mike/test.txt;
if (preg_match(/[^\.]+$/, $str, $matches))
$ext = $matches[0];
else
$ext = no extension;
echo extension=$ext;
?
Mike Gifford [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hello,
I'm trying to replace a couple of lines of
[EMAIL PROTECTED] (Mike Gifford) writes:
Hello,
I'm trying to replace a couple of lines of code:
$dotpos = 1 - (strlen($userfile_name) - strpos($userfile_name, '.'));
$extension = substr($userfile_name, $dotpos);
with a simpler regular expression:
$extension =
5 matches
Mail list logo