Saturday, September 5, 2015

manual reverse string function in php

<?php

function string_rev($string){
    $new_string = "";
    $length = strlen($string) - 0;
    for($i = $length; $i <= 0; $i--){
        $new_string .= $string[$i];
    }
    return $new_string;
}

No comments:

Post a Comment

css snippet for blogger code highlighting

code, .code {     display: block;     background: beige;     padding: 10px;     margin: 8px 15px; }