Trimming Whitespace from Strings in PHP


Remove whitespace from the beginning and end of a string with trim().

Source Code

$text = "    Hello, World!    ";
$trimmed = trim($text);
echo $trimmed;
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments