I hit send right as I saw a typo (the ')' in the echo statement.  Should be
this:

foreach($numeric_array as $key => $value ) {
        if(strstr($value,","))
        {
                $value = ereg_replace(",","",$value);
                echo "comma stripped";
        }
}


-----Original Message-----
From: Matt Honeycutt [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 11:56 AM
To: php
Subject: RE: [PHP] re: strip comma from $value


ereg_replace returns a string, regardless of whether or not any replacement
occured.  If no replacement occurs, the original string is returned.

Additionally, it does not modify the original string, so you need to store
the string it returns:

foreach($numeric_array as $key => $value ) {
        if(strstr($value,","))
        {
                $value = ereg_replace(",","",$value);
                echo "comma stripped");
        }
}

Give that a shot and see if it works (I didn't test it, but it should).

---Matt

-----Original Message-----
From: Jim Long [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 11:42 AM
To: php
Subject: [PHP] re: strip comma from $value


Hi,

Trying this:

//strip the commas from numeric array so it can sort properly-------

foreach ($numeric_array as $key => $value) {
if (ereg_replace ("," , "", $value)){
echo("comma striped");
}
}

Does the same thing as before, echo's comma stripped, but does not
actually remove the commas

THANKS.. any other ideas?
Jim Long
--

--
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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to