There are several ways you can reverse a string in PHP. One is using default function and the 2nd way is without using default function.
Here is the one using default PHP reverse function:
Syntax:
string strrev ( string $string )
Example:
<?php $str = "RADIO"; echo strrev ( $str ); ?>
Without using default string functions:
<?php
//your string
$string = 'TEST';
//find string length
$len = strlen($string);
//loop through it and print it reverse
for ( $i = $len - 1; $i >=0;$i-- )
{
echo $string[$i];
}
?>You got how it is working now?. Enjoy then.
a very easy program
nice example