0
I’m having a problem when the user climbs up a .CSV. file If in some of the fields there is a blank space at the end I can’t remove it in any way.
For example: "[email protected] "
I’ve tried to use trim()
, rtrim()
and it doesn’t work
When I use str_replace()
it removes all the spaces you have in the middle of the string but the one at the end does not remove.
I have looked everywhere and can’t find a solution. If anyone can help me, I would appreciate.
Code as requested:
foreach($column_headers as $key => $value)
{
$result[$new_row][$value] = trim($data[$key]);
}
Put the code snippet, it’s easier to understand the problem.
– Marcos Marques
@Marcosmarques edited the question with the code as requested. Thanks
– Lucas_SCCP
Have you considered the ascii table in str_replace?
– Bruno Folle