I have an array of 100 links (each array element is a link) and I want to process to 5 at a time. I was thinking of using array_slice() to achieve this however once the first 5 elements are processed I want to remove them from my array so only the unprocessed links to remain in it until all the elements are processes and array becomes empty.
My code looks like this:
$links = array("http://www.example.com", "http://www.example.com", "http://www.example.com", "http://www.example.com", "http://www.example.com", "http://www.example.com", "http://www.example.com", "http://www.example.com", "http://www.example.com");
$first_five = array_slice($links, 0, 5);
foreach($first_five as $ff) {
process_link($ff);
}
// so far so good but how do I remove the processed elements and process the remaining onces until $links[] is empty? ?>