When I run it and load row with 123 123 123 from excel this dont make me 123123123.
That’s what trim($str)
is supposed to do: stripping whitespaces from the beginning and end of $str
. Attention: only whitespace from the beginning and end. See the documentation.
To achieve what you want, simply replace all spaces with an empty string:
$subject = "123 123 123";
$output = str_replace(" ", "", $subject);
echo $output;
It outputs
123123123
solved PHP trim() doesn’t work well [closed]