Here is a bad way to do it, but it works

<?
$string = "test.jpg";

$replace = eregi_replace("....$", "", $string);

echo $replace;
?>

Jerry Lake 

-----Original Message-----
From: Tait Grove [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 16, 2001 12:01 PM
To: PHP GENERAL
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