<?php

$str = "string to be reverse";
echo $str;
echo "\n";
//Output 1 = 'esrever eb ot gnirt'
$str_length = strlen($str);

$revstr = '';
for($i=$str_length;$i > 0;$i--){
    
    $revstr .= $str[$i];
}

echo $revstr;
echo "\n";
//Output 2 = 'reverse be to string'
$strexp = explode(' ',$str);
$revstr = '';
for($i=count($strexp);$i >= 0;$i--){
    
    $revstr .= $strexp[$i].' ';
}

echo $revstr;

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: