Replace first word of sentence to the end if it is “the” [closed]

Please try this:

<?
$str="The Hunger Games";
if (strtolower(substr($str,0,3)) == "the"){
    $str = trim(substr($str,3)).', The';
}
echo $str;
?>

WORKING CODE

Browse More Popular Posts

Leave a Comment