Saturday, 27 September 2014

How to print string in reverse order using recursion?

function reverse_recursion($str){
    if(strlen($str)==1)
        return $str;
    else{
        $len = strlen($str);
        return ucwords(reverse_recursion(substr($str,1,strlen($str)-1)).$str[0]);
    }
}


echo reverse_recursion('Kumar Abhimanyu');

No comments:

How calulation total value for HTML input text?

<script> $j(document).ready(function(){ $j(":text").keyup(function(){ if (isNaN($j(this).val())) { alert(...