|
|
|
<?
if (empty($integerNo)){
?>
<p>ZERO</p>
<?
}else{
if($integerNo % 2){
?>
<p>ODD</p>
<?
}else{
?>
<p>EVEN</p>
<?
}
}
?> |
|
| Library of math functions to expand the functionality of PHP3. Version 1.2.1 fixes a major problem with the gcd function.
Categories : Algorithms, PHP, Math. | | | Prime number finder (Sieve of Erastothenes) Categories : PHP, Algorithms, Math. | | | Diffusion-Limited Aggregation visualization Categories : PHP, Graphics, Algorithms, Math. | | | Reverse a given number Categories : PHP, Beginner Guides, Algorithms, Math. | | | Show the steps for converting a number from a given base to base 10. Shows the steps involved in converting a number from a given base to base 10. Categories : PHP, Math., Algorithms | | | How to Generate a random 8 character string in php3? Categories : PHP, Algorithms | | | Credit Card Identification and Validation Class - The credit_card class provides methods for cleaning, validating and identifying the type of credit card numbers. Categories : PHP, PHP Classes, Credit Cards, Ecommerce, Algorithms | | | Prime Spiral is a image plotted with all the primes in a number spiral.
Categories : Algorithms, Graphics, GD image library, Math. | | | Boolean Keyword Interpreter Categories : PHP, Algorithms, Search Engines | | | Dollar Serial Number Validator Categories : PHP, Security, Algorithms | | | Latitude-Longitude to Miles Categories : PHP, Utilities, Math. | | | Math operations on big numbers Categories : PHP, Math. | | | what salt do I have to feed the crypt function with to make it work like the htpasswd command of apache? Categories : Algorithms, PHP, Authentication | | | The Porter Word Stemming Algorithm in PHP
Reduces words to their base stem for search engines and indexing Categories : Algorithms, PHP, Strings | | | Mail-lib provides a simple interface to the sendmail program. Note: you must actually have sendmail on your machine (sorry windows NT users). Categories : Algorithms, Email, PHP | |
| | | | Mahendra Kalkura wrote : 816
hey buddy
look at the code below
this thing works fine for me
test it out and tell me if it works for you ok
<?php
$integer=676;
if (empty($integer))
{
print("ZERO");
}
else
{
if(($integer % 2)==1)
{
print("ODD");
}
else
{
print("EVEN");
}
}
?>
| | | | Alix Axel wrote :1794
Well, 0 (zero) is a even number you could simply write a function like this:
<?php
function Even($number)
{
return $number % 2 == 0;
}
// or:
function Odd($number)
{
return $number % 2 == 1;
}
?>
| |
|
|