note 35338 added to function.floor

From: Date: Thu, 28 Aug 2003 07:08:49 +0000
Subject: note 35338 added to function.floor
Groups: php.notes 
Request: Send a blank email to php-notes+get-55202@lists.php.net to get a copy of this message
The following function uses fmod() rather than floor() to determine odd vs even. Please email me and accept my apology for the garbage note if there is an intrinsic PHP function to accomplish this... Function IsEven($integer) { // Expects integer (whole number) $result = fmod($integer,2); If($result == 1) { Return(FALSE); } ElseIf($result == 0) { Return(TRUE); } Else { // Error } } ---- Manual Page -- http://www.php.net/manual/en/function.floor.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35338 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35338&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35338&report=yes

« previous php.notes (#55202) next »