The result of this code:
echo trim('سلام؟', '؟');
Is �لام
.
Why? I don't even know what's �
supposed to be. Where does that come from?
I think this is because it is right-toleft- language, You can use rtrim()
phpFiddle - Hit "Run F9" to execute
echo rtrim('سلام؟', '؟');