Skip to content

Instantly share code, notes, and snippets.

@joshuabaker
Created March 30, 2011 15:53
Show Gist options
  • Save joshuabaker/894658 to your computer and use it in GitHub Desktop.
Save joshuabaker/894658 to your computer and use it in GitHub Desktop.
Detect if a number is odd or even.
$number = 10;
echo ($number & 1) ? "odd" : "even";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment