trim() Strips Form Feed By Default¶
trim(), ltrim() and rtrim() remove a fixed set of characters by default when no second argument is provided. Until PHP 8.6, that set was space, tab, newline, carriage return, NUL byte and vertical tab. In PHP 8.6, the form feed character (\f, \x0C) was added to that default set.
PHP code¶
<?php
var_dump(trim("\fHello\f"));
?>
Before¶
string(7) Hello
After¶
string(5) Hello
PHP version change¶
This behavior changed in 8.6