Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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.

See Also

Extension

© 2023-2026, Damien Seguy - Exakat