$days = 14; //AT THIS PIONT, $DAYS IS THE SAME AS $_POST['DAYS']; global $referrals; $days2 = 0; $days--; //HERE I DECREASE DAYS BY ONE TO ALLOW FOR A ZERO COUNT. $ramt = array( 'BUNDLE_A' => '250', 'BUNDLE_B' => '500', 'BUNDLE_C' => '1250', 'BUNDLE_D' => '2500', 'BUNDLE_E' => '3750', 'BUNDLE_F' => '5000' ); while ($days2 <= $days) { $dtemp = date(dny,mktime(0, 0, 0, date("n") , date("d")-$days2, date("y"))); $date[] = $dtemp; $days2++; $currentread = 'logs\\' . $dtemp . '.txt'; if (file_exists($currentread)) { $writevar = fopen($currentread,'r'); $read = file($currentread); foreach($read as $wholething) { $newarray = explode('#',$wholething); if ($newarray[2] != 99) { $ubertemp = $newarray[1]; $referrals[] = "$newarray[2]#$ramt[$ubertemp]"; } } } else { //HERE'S WHERE IT DOES STUFF ONCE IT FINISHES CYCLING THROUGH THE LOGS. print_r($date); print_r($referrals); die(); } } Instead of die(); is there anything else i can use to jump out of the loop? EDIT: you can use break; last;