Re: Stripping out last 3 characters??
| From: | Dan Lowe | Date: | Fri, 08 Dec 2000 05:20:14 +0000 |
| Subject: | Re: Stripping out last 3 characters?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29282@lists.php.net to get a copy of this message | ||
Previously, Sandeep Hundal said:
>
> How do I strip out the last 3 characters of any given string?
>
> I tried using substr but not sure how to make it work given that I
> dont know where it should start stripping chars from. :(
<?php
$str = 'abcdefghijklm';
print substr($str, 0, strlen($str)-3);
?>
Will produce this output:
abcdefghij
-dan
--
Dan Lowe <dan@tangledhelix.com> http://tangledhelix.com/
Politics is the art of looking for trouble, finding it whether it exists or
not, and applying the wrong remedy. -Ernest Benn