Need to remove the trailing whitespace characters from a string in php? chomp() is how you do it in Perl, however in PHP it’s just as easy. Simply use rtrim(): // $string = “|my string with trailing whitespace |” $string = rtrim($string); // $string = “|my string with trailing whitespace|” It’s that easy! There is [...]