Re: Stripping out last 3 characters??
| From: | Marcelo Gulin | Date: | Fri, 08 Dec 2000 15:38:03 +0000 |
| Subject: | Re: Stripping out last 3 characters?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29362@lists.php.net to get a copy of this message | ||
Hi!
Try this...
<?
function strip_chars( $strSource, $intCharsToStrip ) {
$intLenSource = strlen( $strSource ) ;
return( substr( $strSource, 0, $intLenSource - $intCharsToStrip ) ) ;
}
print strip_chars("Strip last chars...", 3) ;
?>
good luck
Marcelo Gulin
Sandeep Hundal escribió:
> Ok,
>
> I've been busting the php manual and the archives to find this, but I
> can't, so sorry for asking a question which looks so trivial :(
>
> 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. :(
>
> Thanks in advance!!!
>
> Sunny
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net