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" <[EMAIL PROTECTED]>
To: "PHP GENERAL" <[EMAIL PROTECTED]>
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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to