Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

The winner will be the one to use the shortest code to reverse this string:

Today there was two clouds in the sky, each forming a shape.

It may be in any programming language.

share|improve this question

marked as duplicate by Kendall Frey, Cruncher, ProgramFOX, Justin, Abhijit Feb 4 '14 at 18:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Why PHP? Puzzles are encouraged to be language-agnostic. – Kendall Frey Feb 4 '14 at 17:37
    
This question appears to be off-topic because it is about printing a string, rather than a programming challenge – Justin Feb 4 '14 at 18:39

Python, 7+str

print'.epahs a gnimrof hcae ,yks eht ni sduolc owt saw ereht yadoT'
share|improve this answer

PHP 14 +str

as in

<?=strrev('Today there was two clouds in the sky, each forming a shape.');

?

it doesn't sound like a particularly interesting challenge

share|improve this answer
    
Here's a valid golf for PHP (also works in HTML): .epahs a gnimrof hcae ,yks eht ni sduolc owt saw ereht yadoT – Braden Best Feb 11 '14 at 2:35
    
@B1KMusic i didn't do it that way because in my opinion it's longer, since it doesn't contain the obligatory string, but another string that represents the reversed one – Einacio Feb 11 '14 at 16:06
    
I'm not sure what you're getting at, but the challenge is "Shortest code to reverse a string". Why would you want longer code? And if you're saying the snippet I suggested is longer, a simple echo [str] | wc -c reveals that my snippet is 61 chars, and your golf is 14 chars longer, weighing in at 75 chars. I'm also unclear on what you mean by "in my opinion it's longer", because as we all know, length is an objective thing, while opinions are subjective. Fact != Opinion – Braden Best Feb 11 '14 at 16:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.