PX : code

odd and even by yoshikuni tamura
Download this code


<?


//returns 1 if $num is odd number, and returns 0 if $num is even number.
//奇数の時に1を、偶数の時に0を返します。(奇数のときにTRUEを返す)
function odd_even($num){
    if(!is_long($num/2)){
        $rtn = 1;
    }else{
        $rtn = 0;
    }
    return $rtn;
}

//ex:

$num = 5; //number you use.
if(!odd_even($num)){
    print("the number is even");
}else{
    print("the number is odd");
}

?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.