Reverse each word of a string separately without in built PHP function.


<?php
$string = "How are you";
$strRev = explode(" ", $string); //Array ( [0] => How [1] => are [2] => you )

function revStr($string1){
   
    $string = $string1;
    $string_len = strlen($string);
    $revStr = ' ';
   
    for($i = $string_len - 1; $i > -1;  $i--){
        $revStr .= $string{$i};
    }
    echo $revStr;
   
}


//Now take every single string using foreach function.
foreach($strRev as $str_rev){
    revStr($str_rev);
    //OutPut : woH era uoy;
}



?>