MajorGeeks Support Forums

Go Back   MajorGeeks Support Forums > ----------= PC, Desktop and Laptop Support =---------- > Software
Register FAQ Members List Calendar Casino Mark Forums Read

Software Software such as operating systems like Windows XP, Windows Vista, Windows 7 etc., or specific programs.


Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-04, 23:19
man_im_bored's Avatar
man_im_bored man_im_bored is offline
Private First Class
 
Join Date: May 2003
Location: australia
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default in PHP integers...

Is there a function which returns something to say if a number is divisible by two / even or odd?!?!?]]

like:

function foo($number)
{
if (number_divisble_by_two($number))
{
//stuff
}
else
{
//different stuff
}
}

or

function fooVersion2point0($number)
{
if (even_number($number))
{
//stuff
}
else //number is odd
{
//different stuff
}
}
__________________
Don't listen to me, I don't know what I'm on about...

Last edited by man_im_bored; 01-25-04 at 23:29..
Reply With Quote
Sponsored links
  #2  
Old 01-27-04, 00:12
man_im_bored's Avatar
man_im_bored man_im_bored is offline
Private First Class
 
Join Date: May 2003
Location: australia
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Solution:

(I've figured it out, so I'm posting it for the benefit of otheres...)

function oddoreven($number)
{
if ($number % 2 == 1) {
return "the number is odd";
}
else
{ return "the number is even";}
}

% = a mod
__________________
Don't listen to me, I don't know what I'm on about...
Reply With Quote
  #3  
Old 01-27-04, 06:06
Kodo's Avatar
Kodo Kodo is offline
SNATCHSQUATCH
 
Join Date: Jan 2002
Location: Syracuse NY, USA
Posts: 11,502
Thanks: 17
Thanked 72 Times in 49 Posts
Default

try the mod function.
__________________
"The American people will never knowingly adopt Socialism..." -Norman Thomas
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
IIS on Win2k3 Server, getting some probs with php goldfish Software 3 01-13-04 15:28
PHP - fopen() and fwrite() man_im_bored Software 0 12-26-03 06:51


All times are GMT -5. The time now is 00:08.

MajorGeeks.Com Menu

MajorGeeks.Com \ All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ NEW! PC Games \ System Tools \ Macintosh \ Demonews.Com \ Top Downloads

MajorGeeks.Com \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds


All content Copyright MajorGeeks.com source code Powered by vBulletin® Version 3.8.4
Copyright © 2009 vBulletin Solutions, Inc. All rights reserved.
Ad Management by RedTyger