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? 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. 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 !== ? 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 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> 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. 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? 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() 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
Archived
This topic is now archived and is closed to further replies.