[PHP] character replace function
I need a function that will erase a particular character in a string. Any ideas?!? THANKS
Re: [PHP] character replace function
Try: $outputstring = str_replace($character_to_erase, '', $inputstring); -- Aaron Gould [EMAIL PROTECTED] Web Developer - Original Message - From: Phil Schwarzmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 14, 2002 1:38 PM Subject: [PHP] character replace function I need a function that will erase a particular character in a string. Any ideas?!? THANKS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] character replace function
you want to remove a char at position $x. so $the_string = substr($the_string,0,$x).substr($the_string,$x+1,strlen($the_string)-1-$x); you can do some juggling in the second substr() with negative values for the parameters but they will not be more fast than this. Best regards, Andrey Hristov - Original Message - From: Phil Schwarzmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 14, 2002 8:38 PM Subject: [PHP] character replace function I need a function that will erase a particular character in a string. Any ideas?!? THANKS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] character replace function
Erase by what criteria? Position? Value? specifics!! -Original Message- From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 12:38 PM To: [EMAIL PROTECTED] Subject: [PHP] character replace function I need a function that will erase a particular character in a string. Any ideas?!? THANKS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] character replace function
You can also use the strtr() function: $new_data = strtr($data, ', `);// replaces ' with ` Also keep in mind that you can use the chr($number) to return special ascii characters. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] On Thursday, February 14, 2002, at 10:48 AM, Aaron Gould wrote: Try: $outputstring = str_replace($character_to_erase, '', $inputstring); -- Aaron Gould [EMAIL PROTECTED] Web Developer - Original Message - From: Phil Schwarzmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 14, 2002 1:38 PM Subject: [PHP] character replace function I need a function that will erase a particular character in a string. Any ideas?!? THANKS -- 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