joecooper Posted August 28, 2011 Share Posted August 28, 2011 Hi, How can i check if a string is a multiple of 0.1 without anything being left over? like 1.6 = true, 1.46 = false Link to comment https://forums.phpfreaks.com/topic/245892-check-if-string-is-multiple-of-01/ Share on other sites More sharing options...
Alex Posted August 28, 2011 Share Posted August 28, 2011 That's the same as: $str = '1.46'; if(intval($str * 10) == $str * 10) { // it is } Link to comment https://forums.phpfreaks.com/topic/245892-check-if-string-is-multiple-of-01/#findComment-1262867 Share on other sites More sharing options...
joecooper Posted August 28, 2011 Author Share Posted August 28, 2011 and if wanted to check if 0.05, i would * 100? Link to comment https://forums.phpfreaks.com/topic/245892-check-if-string-is-multiple-of-01/#findComment-1262893 Share on other sites More sharing options...
Alex Posted August 29, 2011 Share Posted August 29, 2011 No, 20. Link to comment https://forums.phpfreaks.com/topic/245892-check-if-string-is-multiple-of-01/#findComment-1263008 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.