Martin AJ Martin AJ - 1 year ago 65
PHP Question

Why trim() affects on the other characters?

The result of this code:

echo trim('سلام؟', '؟');


Is
�لام
.

Why? I don't even know what's
supposed to be. Where does that come from?

Answer Source

I think this is because it is right-toleft- language, You can use rtrim()

phpFiddle - Hit "Run F9" to execute

echo rtrim('سلام؟', '؟');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download