inTime)) < date("h:i:s",strtotime($time))) //Compares if the inTime of stored in each json is less than the one in the time variable. { unset($db[$i]);//Removes the json in db[i]. $change = True;//Indicates that their was change in db. } } if ($change == True)//Check if there was a change in db. { file_put_contents("/var/www/html/db.txt", $db);//Rewrites the db.txt with the contents of db. } ?>