Number Parity function (checking if a number is odd or even)


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. if ($i&1) {
  2. 3.
  3. {
  4. 4.
  5. echo "$i is odd";
  6. 5.
  7. }
  8. 6.
  9. else
  10. 7.
  11. {
  12. 8.
  13. echo "$i is even";
  14. 9.
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.