fork download
  1. <?php
  2.  
  3. function reverseWords($text) {
  4. $words = explode(' ', $text);
  5. $c_words = count($words);
  6. $outtext = "";
  7. for ($i = 0; $i < $c_words; $i++) {
  8. if ($i !== 0) $outtext .= " ";
  9. $outtext .= strrev($words[$i]);
  10. }
  11. return $outtext;
  12. }
  13.  
  14. echo reverseWords("This is a test.");
  15.  
  16. ?>
Success #stdin #stdout 0s 13112KB
stdin
Standard input is empty
stdout
sihT si a .tset