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 Quote Link to comment Share on other sites More sharing options...
Spixxx Posted March 18, 2006 Share Posted March 18, 2006 I would assume 50,000 ... ? Quote Link to comment 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. Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Rehehelly Posted March 18, 2006 Author Share Posted March 18, 2006 I love you. Quote Link to comment 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] 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.