Captain09 Posted July 16, 2012 Share Posted July 16, 2012 Hi, I have in the config file: define("VARIABLE","3600*12"); and now I want that the other file calculates it into hours: if(VARIABLE== 3600){ echo ''.(VARIABLE/3600).' hour'; } else if(VARIABLE>= 3601 AND 86400 <= 86400){ echo ''.(VARIABLE/3600).' hours'; } but it always shows me 1hour because it doesn't recognize the *12 anyone could help me??? Quote Link to comment Share on other sites More sharing options...
Jessica Posted July 16, 2012 Share Posted July 16, 2012 You're putting that inside a string, which makes it the string 3600*12. Just do the math and save it. define('VARIABLE', 43200); Quote Link to comment Share on other sites More sharing options...
Mahngiel Posted July 16, 2012 Share Posted July 16, 2012 define("VARIABLE","3600*12"); What's the sense in this? Just do the math yourself (Plus, it's a string when quoted ^jesi) if(VARIABLE== 3600){ echo ''.(VARIABLE/3600).' hour'; } Foremost, this is pointless logic. IF it's equal to 3600, why perform math when you know the output will be static? Methinks you've left the most important information out. Quote Link to comment Share on other sites More sharing options...
Captain09 Posted July 16, 2012 Author Share Posted July 16, 2012 can I let php do the math for me? It should be easy to config and you can set hours easier with 3600*x Sure I can do the math on my own but its more confortable to config Quote Link to comment Share on other sites More sharing options...
Jessica Posted July 16, 2012 Share Posted July 16, 2012 Try doing it not in a string. If you're doing it for every single hour, you're doing something wrong with your logic. Quote Link to comment Share on other sites More sharing options...
Mahngiel Posted July 16, 2012 Share Posted July 16, 2012 why don't you tell us what you're really doing, and we can advise you more properly. Quote Link to comment Share on other sites More sharing options...
Captain09 Posted July 16, 2012 Author Share Posted July 16, 2012 Its the newbox of a browsergame for the duration of the beginner protection. If the duration is 1h it shows you 1 hours. So I wanted to correct it. Quote Link to comment 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.