RE: [PHP] How can I remove the last character from a one line fil e?

From: Date: Tue, 28 May 2002 16:36:57 +0000
Subject: RE: [PHP] How can I remove the last character from a one line fil e?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-99508@lists.php.net to get a copy of this message
Ouch! echo substr($string,0,-1); is much more efficient. -Rasmus On Tue, 28 May 2002, Scott Hurring wrote: > TIMTOWTDI > > $string = "Jacko"; > print preg_replace('/.$/', '', $string); > > --- > Scott Hurring > Systems Programmer > EAC Corporation > ScottH@eac.com > Voice: 201-462-2149 > Fax: 201-288-1515 > > > -----Original Message----- > > From: Ed Gorski [mailto:gorskie@spjc.edu] > > Sent: Tuesday, May 28, 2002 9:41 AM > > To: Rea_David@emc.com; php-general@lists.php.net > > Subject: Re: [PHP] How can I remove the last character from a one line > > file? > > > > > > Try: > > > > $string="Jacko"; > > $string=substr($string,0,(strlen($string)-1)); > > echo $string; > > > > ed > > > > At 09:35 AM 5/28/2002 -0400, Rea_David@emc.com wrote: > > >Hi all, > > > > > > How can I remove the last character from a one line file? > > > i.e. I need to change Jacko to Jack > > > > > > > > >I would really appreciate a response on this! > > > > > >Thank you! > > >Dave > > > > > >-- > > >PHP General Mailing List (http://www.php.net/) > > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > #################################### > > Edmund Gorski > > Programmer / Analyst > > WWW Coordinator Dept. @ District Office > > 727-341-3181 > > #################################### > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#99508) next »