News:

SMF - Just Installed!

Main Menu

Remove characters from both sides of a string

Started by KingSparta, Dec 16, 2023, 02:21 PM

Previous topic - Next topic

KingSparta

Remove characters from both sides of a string ("He" in "Hello" and "d!" in "World"):

<?php
$str = "Hello World!";
echo $str . "<br>";
echo trim($str,"Hed!");
?>