Skip to content

PHP Program 17

Design a program to reverse a string word by word.

<?php
   $Str = "october 13 on class php a is this";
   $inpStrArray = explode(" ", $Str); 
   $revArr = array_reverse($inpStrArray); 
   echo "The reversed string words are  : " . $revStr = implode(" ", $revArr);
?>

Output