-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
, 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
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
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]
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
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
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
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
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
; 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
10 matches
Mail list logo