Re: removing chars from string
| From: | John Nichel | Date: | Mon, 27 Jun 2005 16:07:16 +0000 |
| Subject: | Re: removing chars from string | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-217700@lists.php.net to get a copy of this message | ||
Stut wrote:
Jay Blanchard wrote:Forgive us, it's Monday. $newstring = substr ( $oldstring, 0, 9 ); Will knock the last two characters off of an eleven character string. 0 is the starting point, and 9 is the length you want returned.... $newstring = substr ( $oldstring, 1, 9 ); Will knock off the first and last character of an eleven character string (giving you the 'middle' 9 characters). $newstring = substr ( $oldstring, 0, -2 ); Will knock the last two characters off a string of any length. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 john@kegworks.com0-8 is nine characters, which is two less than eleven, IIRCSo the length should be 9 not 8 no? Or should I go back to school?