Re: string replace
| From: | Nathan Cook | Date: | Tue, 16 Jan 2001 20:15:10 +0000 |
| Subject: | Re: string replace | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34894@lists.php.net to get a copy of this message | ||
You may want to try exploding on the ".":
$fooPieces = explode($foo, ".");
That way everything before the dot, is in the first piece of the array and
everything after is in the second part of the array. However this may cause
issues if filenames will contain dots. But if you follow an 8.3 or 8.4
character filename structure you will be fine.
.:: Nathan Cook
----- Original Message -----
From: "Tait Grove" <taitg@digitalimagination.com>
To: "PHP GENERAL" <php-general@lists.php.net>
Sent: Tuesday, January 16, 2001 1:01 PM
Subject: [PHP] string replace
How can I strip everything past a certain character in a string?
i.e.:
$foo = "test.gif";
// strip past the .gif
$foo = "test";
// again
$foo2 = "test.jpeg";
// strip past the .jpeg
$foo2 = "test";
Tait