Hello all i have major problem, i have an array with length greater than 4000. In a foreach loop i tried to unset each key but its not working properly.
$arr=array( 0 => '365-pramo@mageos.com',
1 => '365-pram@mageos.com',`.....`
4000 => '5333-pram123@mageos.com');
Here i need to get each mail id and user id from this array(its actually getting from a table) i will send mail to each mail id and update that in my table. Here is my code.
if(!empty($uids_eidsArr)){
foreach($uids_eidsArr as $k=>$v){
//echo $v;
// echo $r->id;('-',
$eArr= explode('-', $v);
$headers= 'From: Ldamsin <admin@domain.org>' . "\r\n";
$headers.="MIME-Version: 1.0\r\n";
$headers.="Content-Type: text/html;\n\tcharset=\"iso-8859-1\"\r\n";
$content = $res_dup[0]->newsletter_content;
@mail($eArr[1], $res_dup[0]->newsletter_subject, $content, $headers); // mail to client
$this->db->set('user_id',$sent_by);
$this->db->set('sent_to',$eArr[0]);
$this->db->set('isSubscriber',$isSubscriber);
$this->db->set('content_id',$newsId);
$this->db->insert('newsletter_senthistory');
// echo '<pre>';print_r($uids_eidsArr);echo '</pre>';
unset($uids_eidsArr[$k]);
//echo '<pre>';print_r($uids_eidsArr);echo '</pre>';
sleep(36);
} }
But it is not unset all keys . I don't know what's the problem. Is it because of sleep function. Because of this some users getting more than 40 mails each time. Please help me.