Last active
September 20, 2018 17:14
-
-
Save Kiwipup/5af3c3fb173d51f59310fd2071db1da5 to your computer and use it in GitHub Desktop.
First Reverse in php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function FirstReverse($str) { | |
// code goes here | |
/*Here the built in function strrev() takes the value of $str | |
as an argument and returns a reversed string */ | |
return strrev($str); | |
} | |
// keep this function call here | |
echo FirstReverse(fgets(fopen('php://stdin', 'r'))); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks good. It’s nice to be able to solve a problem with a built-in like
strrev
, but also good to think about how to solve the problem without it.