Re: string replace
| From: | Monte Ohrt | Date: | Wed, 17 Jan 2001 15:22:03 +0000 |
| Subject: | Re: string replace | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35047@lists.php.net to get a copy of this message | ||
If you're looking to strip off just the file extension, you can use
pathinfo() to get that. I don't think it is a documented function, so
use var_dump(pathinfo($var)) to see what it outputs.
Tait Grove wrote:
>
> 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
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/