Difference

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sandy1028
Forum Commoner
Posts: 60
Joined: Thu Jul 26, 2007 3:56 am

Difference

Post by sandy1028 »

Hi,

Is there any way to differentiate between 0 and 0.00.

$a=0;
$b=0.00;

Code: Select all

In a function I have to assign color 
function FCallback($aVal) {
 
    if( $aVal == 0 ) $c = "red";
    elseif( $aVal == '0.00' ) $c = "black";
    else $c="green";
    return array(3,"",$c);
}
But if aVal is 0 and 0.00 same color is printed. Is there anyway to differentiate between the two.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: Difference

Post by Ollie Saunders »

is_float()
is_int()
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Difference

Post by Ambush Commander »

use ===
Post Reply