Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 PHP Code: Easily detect Odd/Even numbers Jump to:  
Category: >> PHP Code >> Easily detect Odd/Even numbers Bookmark and Share

<< lastnext >>

Snippet Name: Easily detect Odd/Even numbers

Description: This is a simple way to tell whether a given number is odd or even. It works via a bitwise compare. You really only need one of these functions, since if a number isn't odd, it's even.

Also see:
» Easily detect Odd/Even numbers
» Dates: Oddball Stuff
» Set cookie even after HTML output
» Prevent the 'enter' key from submiting...
» Is Number Even?
» Prevent framing a page

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: August 01st, 2009

FUNCTION odd($var) {
    RETURN($var & 1);
}
 
FUNCTION even($var) {
    RETURN(!($var & 1));
}


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 79 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?