Or just: $string = "Jacko"; $string = substr( $string, 0, -1 ); echo $string;
The third argument to substr() means 'one character from the end', see http://www.php.net/manual/en/function.substr.php - Kev > -----Original Message----- > From: Ed Gorski [SMTP:[EMAIL PROTECTED]] > Sent: 28 May 2002 14:41 > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > 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, [EMAIL PROTECTED] 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 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. ********************************************************************** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php