Created
January 27, 2018 11:42
-
-
Save Tobur/ce8d7ea85ae9cee77c54e87b4bc26fbf to your computer and use it in GitHub Desktop.
This file contains hidden or 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 revertWord($word) | |
{ | |
$length = strlen($word); | |
for ($i = 0, $j = $length - 1; $i < ($length / 2); $i++, $j--) { | |
$t = $word[$i]; | |
$word[$i] = $word[$j]; | |
$word[$j] = $t; | |
} | |
echo $word; | |
echo "\n\n"; | |
} | |
revertWord('hello my friend!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment