function reverseString($str) {
    
    //Initialize two indexes
    $start = 0;
    $end = strlen($str)-1;     
    
    //If $start is less than $end
    while ($start < $end) {
        //Swap the position of characters
        $temp = $str[$start];
        $str[$start] = $str[$end];
        $str[$end]   = $temp;
        
        $start++;
        $end--;
    }
    
    return $str;
}
 
echo reverseString("SERIF_GUNGOR_BLOG");  //Çıktı - GOLB_ROGNUG_FIRES
php
Bu makaleyi paylaşın:

3 Comments

Bir yorum bırakın