I have a problem when the user uploads a .CSV file. If some of the fields have a blank space at the end I can not remove it in any way.
For example: "[email protected]"
I have tried to use trim()
, rtrim()
and it does not work
When I use str_replace()
it removes all the spaces that it has in the middle of the string but that of the end does not remove.
I have looked everywhere and I do not find a solution. If anyone can help me, thank you.
Code as requested:
foreach($column_headers as $key => $value)
{
$result[$new_row][$value] = trim($data[$key]);
}