RE: [PHP] string replace

From: Date: Tue, 16 Jan 2001 20:15:35 +0000
Subject: RE: [PHP] string replace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-34895@lists.php.net to get a copy of this message
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:taitg@digitalimagination.com] 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

« previous php.general (#34895) next »