Jump to content

comparrison problem


jayR

Recommended Posts

Hi all,

I'm working on, what I thought would be, an easy problem. Its simply an if statement that checks if a value is greater than 1000. However, its not picking anything up and I'm running out of time for this project. My problem code is as follows...


//$AmtOfAdj is set from our database, and I've printed out its values so I know its getting the right values
$AmtOfAdj = number_format($commaFile[$i] * .01, 2);
settype($AmtOfAdj, "float");

if($AmtOfAdj > 1000.00)
{
print $AmtOfAdj . "<br />";
}

I have no idea why its doing this, but I'm stuck so if anyone could help me out I'd appreciate it.

Thanks a lot
Link to comment
https://forums.phpfreaks.com/topic/11511-comparrison-problem/
Share on other sites

I could be mistaken; but when you use the number format to place a 'value' into a variable, that variable is treated as a string NOT a numerical value. Suggest you use the number formating AFTER you have done all your math.


Try adding 3 to your variable and echo it, see what happens
Lite...
Link to comment
https://forums.phpfreaks.com/topic/11511-comparrison-problem/#findComment-43343
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.