php - Array push to end keeping format -


i'm making automated system send out emails. have array containing info registered users: email , forum name/nickname:

$array = [     ['jane.apples@gmail.com', 'jane apples'],     ['jdoe@gmail.com', 'john doe'], ]; 

to send emails uses each loop:

foreach ($array list($email, $name)) {     echo "$email&nbsp;&nbsp;&nbsp;$name<br>"; } 

this yield:

jane.apples@gmail.com   jane apples jdoes@gmail.com   john doe 

in final code this:

foreach ($array list($email, $name)) {     email($email, $name); } 

also, please note array in different file like: array.php , include file.

please me this, , in advance.

update: i've found solution while messing around little bit here code:

<?php  $result = array(); $file = fopen("mail.txt", "r"); while(!feof($file)){     $line = fgets($file);    list($email, $name) = explode(":", $line);   echo $email . ':' . $name .'<br>';  } fclose($file); ?> 

the mail.txt file looks like:

jane.apples@gmail.com:jane apples jdoes@gmail.com:john doe 

if use yourself, edit part echos: $email . ':' . $name . '<br>';


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -