Issue
I have this array:
array:4 [▼
0 => "juego de tronos"
1 => "tagaryen"
2 => "house targaryen"
3 => "casa targaryen"
]
and I want get this result:
array:4 [▼
0 => "juegodetronos"
1 => "tagaryen"
2 => "housetargaryen"
3 => "casatargaryen"
]
I´m using this function but not works: array_map('trim',$myarray)
Solution
trim()
only removes whitespace from the beginning and the end. You probably want
array_map(function($a){
return str_replace(' ', '', $a);
}, $myarray);
Answered By – Daan Meijer
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0