abs0lut Posted October 17, 2008 Share Posted October 17, 2008 I've tried is_float, and it didn't work, could you please help me? Quote Link to comment https://forums.phpfreaks.com/topic/128789-check-if-the-number-has-decimal/ Share on other sites More sharing options...
ratcateme Posted October 17, 2008 Share Posted October 17, 2008 can we see your code to test it you could just use if(strpos($number,".") !== false){ echo "is decimal"; }else{ echo "not a decimal"; } Scott. Quote Link to comment https://forums.phpfreaks.com/topic/128789-check-if-the-number-has-decimal/#findComment-667674 Share on other sites More sharing options...
abs0lut Posted October 17, 2008 Author Share Posted October 17, 2008 whats the name of this operator !== ? Quote Link to comment https://forums.phpfreaks.com/topic/128789-check-if-the-number-has-decimal/#findComment-667682 Share on other sites More sharing options...
darkfreaks Posted October 17, 2008 Share Posted October 17, 2008 not double equal Quote Link to comment https://forums.phpfreaks.com/topic/128789-check-if-the-number-has-decimal/#findComment-667684 Share on other sites More sharing options...
discomatt Posted October 17, 2008 Share Posted October 17, 2008 Does not equal exacty... for example <pre><?php var_dump( TRUE != 1 ); var_dump( TRUE !== 1 ); // also var_dump( TRUE == 1 ); var_dump( TRUE === 1 ); ?></pre> Quote Link to comment https://forums.phpfreaks.com/topic/128789-check-if-the-number-has-decimal/#findComment-667685 Share on other sites More sharing options...
ratcateme Posted October 17, 2008 Share Posted October 17, 2008 strpos() could return 0 if the string you are looking for is at the start and false will == 0 but if you say === it check the value and the data type. for false it is boolean and the value is 0 true is boolean and a value of 1 Scott. Quote Link to comment https://forums.phpfreaks.com/topic/128789-check-if-the-number-has-decimal/#findComment-667692 Share on other sites More sharing options...
sasa Posted October 17, 2008 Share Posted October 17, 2008 does number 5.00 has decimal? Quote Link to comment https://forums.phpfreaks.com/topic/128789-check-if-the-number-has-decimal/#findComment-667717 Share on other sites More sharing options...
ghostdog74 Posted October 17, 2008 Share Posted October 17, 2008 I've tried is_float, and it didn't work, could you please help me? use is_numeric() Quote Link to comment https://forums.phpfreaks.com/topic/128789-check-if-the-number-has-decimal/#findComment-667728 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.