Skip to content

Instantly share code, notes, and snippets.

@koduki
Created June 9, 2009 13:02
Show Gist options
  • Save koduki/126469 to your computer and use it in GitHub Desktop.
Save koduki/126469 to your computer and use it in GitHub Desktop.
<?php
print "演算子優先順位がへんだから、期待通りに動作しない\n";
foreach(range(1, 30) as $x){
print ($x % 15 == 0) ? "FizzBuzz"
:($x % 5 == 0) ? "Fizz"
:($x % 3 == 0) ? "Buzz"
: $x;
print "\n";
}
print "Lisp並にカッコつければOK\n";
foreach(range(1, 30) as $x){
print (($x % 15 == 0) ? "FizzBuzz"
:(($x % 5 == 0) ? "Fizz"
:(($x % 3 == 0) ? "Buzz"
: $x)));
print "\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment