Skip to content

Instantly share code, notes, and snippets.

@six519
Created July 9, 2013 15:58
Show Gist options
  • Save six519/5958565 to your computer and use it in GitHub Desktop.
Save six519/5958565 to your computer and use it in GitHub Desktop.
Reverse Binary (Spotify Puzzle in PHP)
#!/usr/bin/env php
<?php
$stdIn = fopen("php://stdin","r");
$lineInput = fgets($stdIn);
if($lineInput >= 1 && $lineInput <= 1000000000) {
echo bindec(strrev(decbin($lineInput))), "\n";
} else {
echo "Invalid input\n";
}
fclose($stdIn);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment