Skip to content

Instantly share code, notes, and snippets.

@Kiwipup
Last active September 20, 2018 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kiwipup/5af3c3fb173d51f59310fd2071db1da5 to your computer and use it in GitHub Desktop.
Save Kiwipup/5af3c3fb173d51f59310fd2071db1da5 to your computer and use it in GitHub Desktop.
First Reverse in php
<?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')));
?>
@MatthewGidcomb
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment