Hiya, Try this, *probably* more efficient but I don't know for sure.
<? $string = 'testing 1 2 3 testing'; echo $string . "\n"; $string[strlen($string)-1] = "\0"; echo $string . "\n"; ?> Regards, Ian Packer ----- Original Message ----- From: "Douglas Douglas" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, February 08, 2003 1:21 PM Subject: [PHP] How to remove only the last character? > Good day. > > Is there any PHP function that removes only the last > character of a string and returns the new string? > > I'm looking in the manual and I can't find anything. > > Until now I'm doing this: > > $var=substr($var,0,strlen($var)-1) > > Is this the most efficient way? > > Thanks. > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > -- > 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