forumnz Posted January 26, 2008 Share Posted January 26, 2008 I have a variable called $no which = 4.05. How can I make another $variable = just 4? Quote Link to comment https://forums.phpfreaks.com/topic/87883-remove-05-from-405/ Share on other sites More sharing options...
laffin Posted January 26, 2008 Share Posted January 26, 2008 intval($val) floor($val) either shud do the trick. Quote Link to comment https://forums.phpfreaks.com/topic/87883-remove-05-from-405/#findComment-449649 Share on other sites More sharing options...
tapos Posted January 26, 2008 Share Posted January 26, 2008 u can also use round($var); Quote Link to comment https://forums.phpfreaks.com/topic/87883-remove-05-from-405/#findComment-449661 Share on other sites More sharing options...
Daniel0 Posted January 26, 2008 Share Posted January 26, 2008 The problem lies in that you are treating numbers and strings. You shouldn't. Numbers are numbers - strings are strings. Quote Link to comment https://forums.phpfreaks.com/topic/87883-remove-05-from-405/#findComment-449689 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.