digibucc Posted October 30, 2013 Share Posted October 30, 2013 (edited) Ok, I can throw actual code here but it's all rather long, so i am going to give an example: <?php $max = 10; // max runs per exec $arr = array_fill(0, 50, 0); $last = file_get_contents('last.txt'); $n = 0; echo 'left off on '. $last; while ($n < $max) { foreach ($arr as $k => $v) { if ($k > $last) { // do something with the value ($v) $n ++; } } } file_put_contents(last.txt, $k)); ?> <meta http-equiv="refresh" content="3"> this isn't anything i use, but i do something similar when i want to save where i left off in a program to come back to later. that way if the program crashes or i have to close it, i haven't lost my place. this is normally when working with database records. it makes it run incrementally and as i said save it's place to return to. it just feels wrong though, and i'm sure it is. especially the refresh. what is the best way to do this? I would use array_slice instead of if ($k > $last), but that is normally comparing row values from a db, so i can't just arbitrarily slice that. Edited October 30, 2013 by digibucc Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted October 30, 2013 Share Posted October 30, 2013 Sorry I do not understand your question/problem. Could you explain what you are trying to do. Quote Link to comment Share on other sites More sharing options...
digibucc Posted October 30, 2013 Author Share Posted October 30, 2013 i just rewrote it, does that help? 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.