Hackerss.com

Hackerss.com is a community of amazing hackers

Hackerss is a community for developers, data scientitst, ethical hackers, hardware enthusiasts or any person that want to learn / share their knowledge of any aspect of digital technology.

Create account Log in
hackerss
hackerss

Posted on • Updated on

Php Reverse a string


function reverseString($str) {
    $newStr = '';
    for ($i = strlen($str) - 1; $i >= 0; $i--) {
        $newStr .= $str[$i];
    }
    return $newStr;
}

echo reverseString('hello');
Enter fullscreen mode Exit fullscreen mode

Top comments (0)