Rehehelly Posted March 18, 2006 Share Posted March 18, 2006 Okay, so.. i'm tired, probably not the best time to be doing this, but.. maeh.Say I have a list of seconds to get to a game level,Level 1. 1000Level 2. 2000Level 3. 3000Level 4. 4000and so on, if I wanted to calculate how many seconds to get from level 1 to level 50. How would I go about doing that? I told you my mind has gone blank >.<Thanks~Dan Link to comment https://forums.phpfreaks.com/topic/5208-my-minds-gone-blank-calculating/ Share on other sites More sharing options...
Spixxx Posted March 18, 2006 Share Posted March 18, 2006 I would assume 50,000 ... ? Link to comment https://forums.phpfreaks.com/topic/5208-my-minds-gone-blank-calculating/#findComment-18491 Share on other sites More sharing options...
Rehehelly Posted March 18, 2006 Author Share Posted March 18, 2006 I really should have clarified that. I mean likeAdd level 1, level 2, level 3, level 4, level 5, level 6, level 7 etc. till you get to level 50. Link to comment https://forums.phpfreaks.com/topic/5208-my-minds-gone-blank-calculating/#findComment-18566 Share on other sites More sharing options...
wildteen88 Posted March 18, 2006 Share Posted March 18, 2006 Then it'll be a woping total of 1,275,000 secounds!!This how I worked it out:[code]<?php$s = "\$sec = ";for($i = 1; $i < 50; $i++){ $s .= ($i*1000).'+';}$s .= "50000;";echo eval($s);echo $sec;?>[/code] Link to comment https://forums.phpfreaks.com/topic/5208-my-minds-gone-blank-calculating/#findComment-18568 Share on other sites More sharing options...
Rehehelly Posted March 18, 2006 Author Share Posted March 18, 2006 I love you. Link to comment https://forums.phpfreaks.com/topic/5208-my-minds-gone-blank-calculating/#findComment-18582 Share on other sites More sharing options...
Barand Posted March 19, 2006 Share Posted March 19, 2006 Wildteen,Seems a roundabout way of doing it ![code]$sec = 0;for ($i=1; $i <= 50; $i++) { $sec += $i * 1000;}echo $sec;[/code] Link to comment https://forums.phpfreaks.com/topic/5208-my-minds-gone-blank-calculating/#findComment-18767 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.