<?php
echo strrev("Hello world!"); // outputs "!dlrow olleH"
?>
#Text must be in double quotes in brackets
echo strrev("Text goes here");
<?php
$a = “abcdeg”;
echo strrev($a);
?>
use strrev(); function
strrev("web learn smart");
<?php
// Iterative PHP program
// to reverse an array
/* Function to reverse
$arr from start to end*/
function rvereseArray(&$arr, $start,
$end)
{
while ($start < $end)
{
$temp = $arr[$start];
$arr[$start] = $arr[$end];
$arr[$end] = $temp;
$start++;
$end--;
}
}
/* Utility function to
print an array */
function printArray(&$arr, $size)
{
for ($i = 0; $i < $size; $i++)
echo $arr[$i] . " ";
echo "
";
}
// Driver code
$arr = array(1, 2, 3, 4, 5, 6);
// To print original array
printArray($arr, 6);
// Function calling
rvereseArray($arr, 0, 5);
echo "Reversed array is" ."
";
// To print the Reversed array
printArray($arr, 6);
?>