I have the following array:
[0] => Array
(
[0] => 3,38 m
[1] => 13,30 s
[2] => 5,41 m
[3] => ESE
[4] => 294º
[5] => 32,76 km/h
[6] => W
[7] => 266º
[8] => 16,27 ºC
[9] => 12,80 ºC
[10] => 0
)
I'm wanting to clean up the data before adding it to a DB.
This function is almost there but does not remove the special characters:
function cleanUp(&$value,$key)
{
$cleaner2 = array("km/h"," ","m","s","º","ºC");
$value = str_replace($cleaner2, "", $value);
}
array_walk($newArray[0],"cleanUp");
I've looked into encoding the array, but I'm not sure what encoding it has now? I could trim the array values, but feel that is rather inelegant.
Any ideas?
The solution: I omitted the charset from the header!
header('Content-type: application/json; charset=UTF-8');
This allowed my simple cleanUp function to work as it removed the  and then matched the following cleaner2 array values:
$cleaner2 = array("km/h"," ","m","s","º","ºC","C");