RE: [PHP] remove last character in a string

2002-04-23 Thread Ford, Mike [LSS]
-Original Message- From: Evan Nemerson [mailto:[EMAIL PROTECTED]] Sent: 23 April 2002 04:54 Why get strlen involved??? $string = substr($string, 0, -1); Why get quotes involved??? $string = substr($string, 0, -1); Cheers! Mike

Re: [PHP] remove last character in a string

2002-04-23 Thread Evan Nemerson
, April 22, 2002 10:53 PM Subject: Re: [PHP] remove last character in a string Why get strlen involved??? $string = substr($string, 0, -1); -- He is richest who is content with the least, for content is the wealth of nature. Socrates -- Who speaks of liberty while the human mind

Re: [PHP] remove last character in a string

2002-04-22 Thread Rasmus Lerdorf
read php.net/substr On Mon, 22 Apr 2002, Craig Westerman wrote: I have a string that ends in a comma. What is best method to remove the comma? Craig [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] remove last character in a string

2002-04-22 Thread Tyler Longren
First, you'll need to get the length of the str with the str_len() function. After you have that, use the substr() function like Rasmus mentioned. Tyler Longren Captain Jack Communications www.captainjack.com [EMAIL PROTECTED] - Original Message - From: Craig Westerman [EMAIL PROTECTED]

RE: [PHP] remove last character in a string

2002-04-22 Thread Craig Westerman
Wouldn't it be better to check to see if charicater is indeed a comma before removing it? I was guessing eregi_replace would be the way to go. Am I thinking wrong? Craig [EMAIL PROTECTED] First, you'll need to get the length of the str with the str_len() function. After you have that, use

Re: [PHP] remove last character in a string

2002-04-22 Thread Evan Nemerson
Why get strlen involved??? $string = substr($string, 0, -1); -- He is richest who is content with the least, for content is the wealth of nature. Socrates -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] remove last character in a string

2002-04-22 Thread Rasmus Lerdorf
No you don't. You should go read the substr() docs as well: substr($str,0,-1); -Rasmus On Mon, 22 Apr 2002, Tyler Longren wrote: First, you'll need to get the length of the str with the str_len() function. After you have that, use the substr() function like Rasmus mentioned. Tyler

Re: [PHP] remove last character in a string

2002-04-22 Thread Tyler Longren
PROTECTED]; php-general-list [EMAIL PROTECTED] Sent: Tuesday, April 23, 2002 12:04 AM Subject: Re: [PHP] remove last character in a string No you don't. You should go read the substr() docs as well: substr($str,0,-1); -Rasmus On Mon, 22 Apr 2002, Tyler Longren wrote: First, you'll need

Re: [PHP] remove last character in a string

2002-04-22 Thread Tyler Longren
Because I'm kinda stupid. :) tyler - Original Message - From: Evan Nemerson [EMAIL PROTECTED] To: Tyler Longren [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, April 22, 2002 10:53 PM Subject: Re: [PHP] remove last character in a string Why get strlen involved??? $string

RE: [PHP] remove last character in a string

2002-04-22 Thread Matthew Walker
; php-general-list Subject: Re: [PHP] remove last character in a string First, you'll need to get the length of the str with the str_len() function. After you have that, use the substr() function like Rasmus mentioned. Tyler Longren Captain Jack Communications www.captainjack.com [EMAIL PROTECTED