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
https://forums.phpfreaks.com/topic/181720-php-array-from-file/
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: [email protected]' . "\r\n" .

    'Reply-To: [email protected]' . "\r\n" .

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

 

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

?>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/181720-php-array-from-file/#findComment-958467
Share on other sites

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

 

$emails = array("[email protected]", "[email protected]", "[email protected]");
$to = $emails[0];
unset($emails[0]);
$bcc = implode("; ", $emails);

$headers = 'From: [email protected]' . "\r\n";
$headers .= 'Reply-To: [email protected]' . "\r\n";
$headers .= 'BCC: ' . $bcc;
$headers .= 'X-Mailer: PHP/' . phpversion();

Link to comment
https://forums.phpfreaks.com/topic/181720-php-array-from-file/#findComment-958474
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.