Re: Pattern Replacing
| From: | Christian Reiniger | Date: | Fri, 30 Mar 2001 09:41:42 +0000 |
| Subject: | Re: Pattern Replacing | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46279@lists.php.net to get a copy of this message | ||
On Thursday 29 March 2001 22:38, you wrote:
> H-
>
> Thanks to those that emailed.
>
> $query = "tree, bird, nest, ";
> $new = substr($query,0,2);
>
> Doesn't seem to work. It returns "tr".
$new = substr ($query, 0, strlen ($query) - 2);
or
$new = preg_replace ('/,.*?$/', '', $query);
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
"World domination. Fast." (Linus Torvalds about Linux)