Created
April 17, 2012 16:05
-
-
Save dustinlakin/2407198 to your computer and use it in GitHub Desktop.
Reverse Text
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 reverseText($text){ | |
$arr = explode(" ", $text); | |
$result = ""; | |
while($temp = array_pop($arr)) | |
$result .= $temp . " "; | |
return $result; | |
} | |
$text = "The cat in the hat"; | |
echo reverseText($text); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment