PHP trim function removing last character -


i ran weird issue php trim function.

<?php $str = "new multan nagar"; $trimmedstr = trim($str, ' \t\n\r\0\x0b'); var_dump($trimmedstr);// output => string(15) "new multan naga"  $str = "new multan nagar"; $trimmedstr = trim($str, " \t\n\r\0\x0b"); var_dump($trimmedstr); // output => string(16) "new multan nagar" ?> 

second parameter value default value used trim function, difference 1 inside single quotes , other inside double quotes. can explain behavior?

php not recognise slash(/) characters when using single quotes. when wrapped in double quotes seen special characters.

so in case single quoted version removing tnrx0b characters.


Comments