I have an array ($arr):
[0] => Array
    (
        [sv_317] => 1,650
        [sv_318] => 1,254
    )
[1] => Array
    (
        [sv_317] => 1,580
        [sv_318] => 1,580
    )
I am trying to use these element values as number values and so need to remove any non numeric characters (commas in the above example).
To do this I am using:
foreach($arr as $k=>$v)
    {       
    $v[sv_317] = str_replace(",", "", $v[sv_317]);
    $v[sv_317] = preg_replace('/\s+/', '', $v[sv_317]);
    $v[sv_318] = str_replace(",", "", $v[sv_318]);
    $v[sv_318] = preg_replace('/\s+/', '', $v[sv_318]);
    echo "318 :".$v[sv_318];
    echo "317 :".$v[sv_317];
    }
The echos are there just to test that it is doing what I intended, and sure enough they print the values of the elements without commas or white-space.
However this didn't result in being able to use the elements numerically, so I tested the array with print_r($arr); immediately following the above loop, and the array elements appeared unaffected (i.e. still containing commas.
Is there an issue of scope here? If so how can I remove the commas permanently?
Many thanks.
 
     
     
    