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 Quote 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 } Quote 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? Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.