Today, i have very weird problem with trim function.
Here is my code. =and result is 124.
Trim function didn’t work with this string ??!
$s = ' ';
$s = trim($s);
echo strlen($s);exit();
Copy & paste doesn’t work with this code.
i don’t know what white space is? but trim couldn’t strip it 😐
you can test this code here:
test:
http:// 70.38.18.62/t.php
You can copy white space and code over there:
http://jsbin.com/ukunuq/1/edit
When I look at your t.txt, the $s string is not just spaces. In Hex, it reads a mixture of 20 (space) and C2 and A0 characters. You need to lose those C2 and A0 characters.
They may not display on screen, but they are NOT spaces. Here’s my sniff of what’s returned
Possibly encoding the file in 7-bit ASCII would also reveal the problem.
To clean it up, just select all the text in $s, delete it and then hit space bar to get the right number of spaces. Or use str_repeat(‘ ‘, 134) that will do the same. Check the charset of your editor.