Trimming Characters from a String in PHP


Trim specific characters from the beginning and end of a string with trim().

Source Code

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