Jump to content

Php array from file....


Raz0r

Recommended Posts

Ok guys...I need some help...

I do not have idea how to do this:

 

I need PHP code that will open a text document and read it, and store it in the array, in this way.

 

$a=array("1" = "example", "2" = "example2"......., so each line has its number in array...)

 

I hope that this is possible.

Thank you.

Link to comment
Share on other sites

One more question...

 

How do i send mail to addresses in array?

 

Let's say i have this:

 

<?php

$to      = I need addresses from array to be here. 

$subject = 'the subject';

$message = 'hello';

$headers = 'From: webmaster@example.com' . "\r\n" .

    'Reply-To: webmaster@example.com' . "\r\n" .

    'X-Mailer: PHP/' . phpversion();

 

mail($to, $subject, $message, $headers);

?>

 

 

 

 

Link to comment
Share on other sites

Personally I wouldn't put them where you have marked.

 

$emails = array("bob@thebuilder.com", "jim@thebuilder.com", "fred@thebuilder.com");
$to = $emails[0];
unset($emails[0]);
$bcc = implode("; ", $emails);

$headers = 'From: webmaster@example.com' . "\r\n";
$headers .= 'Reply-To: webmaster@example.com' . "\r\n";
$headers .= 'BCC: ' . $bcc;
$headers .= 'X-Mailer: PHP/' . phpversion();

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.