Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- array(2)
- {
- array(6) {
- [0]=>
- array(2) {
- ["email"]=>
- string(17) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [1]=>
- array(1) {
- ["from"]=>
- string(17) "email@test.com"
- }
- [2]=>
- array(1) {
- ["to"]=>
- string(17) "email@test.com"
- }
- [3]=>
- array(2) {
- ["subject_one"]=>
- string(44) "Subject: Undelivered Mail Returned to Sender"
- ["subject_two"]=>
- string(122) "Subject: Undelivered Mail Returned to Sender"
- }
- [4]=>
- array(1) {
- ["date_email_sent"]=>
- string(37) "Date: Wed, 6 Feb 2019 18:01:28 +0800"
- }
- [5]=>
- array(1) {
- ["date_email_parse"]=>
- string(19) "2019-02-15 09:46:16"
- }
- }
- array(28) {
- [0]=>
- array(2) {
- ["email"]=>
- string(17) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [1]=>
- array(2) {
- ["email"]=>
- string(16) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [2]=>
- array(2) {
- ["email"]=>
- string(17) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [3]=>
- array(2) {
- ["email"]=>
- string(16) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [4]=>
- array(2) {
- ["email"]=>
- string(21) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [5]=>
- array(2) {
- ["email"]=>
- string(21) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [6]=>
- array(2) {
- ["email"]=>
- string(19) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [7]=>
- array(2) {
- ["email"]=>
- string(16) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [8]=>
- array(2) {
- ["email"]=>
- string(14) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [9]=>
- array(2) {
- ["email"]=>
- string(14) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [10]=>
- array(2) {
- ["email"]=>
- string(14) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [11]=>
- array(2) {
- ["email"]=>
- string(17) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [12]=>
- array(2) {
- ["email"]=>
- string(18) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [13]=>
- array(2) {
- ["email"]=>
- string(19) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [14]=>
- array(2) {
- ["email"]=>
- string(19) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [15]=>
- array(2) {
- ["email"]=>
- string(17) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [16]=>
- array(2) {
- ["email"]=>
- string(14) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [17]=>
- array(2) {
- ["email"]=>
- string(14) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [18]=>
- array(2) {
- ["email"]=>
- string(16) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [19]=>
- array(2) {
- ["email"]=>
- string(15) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [20]=>
- array(2) {
- ["email"]=>
- string(16) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [21]=>
- array(2) {
- ["email"]=>
- string(18) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [22]=>
- array(2) {
- ["email"]=>
- string(16) "email@test.com"
- ["signature"]=>
- string(29) "Host or domain name not found"
- }
- [23]=>
- array(1) {
- ["from"]=>
- string(17) "email@test.com"
- }
- [24]=>
- array(1) {
- ["to"]=>
- string(21) "email@test.com"
- }
- [25]=>
- array(2) {
- ["subject_one"]=>
- string(44) "Subject: Undelivered Mail Returned to Sender"
- ["subject_two"]=>
- string(175) "Subject: Undelivered Mail Returned to Sender"
- }
- [26]=>
- array(1) {
- ["date_email_sent"]=>
- string(37) "Date: Wed, 15 Aug 2018 17:36:18 +0800"
- }
- [27]=>
- array(1) {
- ["date_email_parse"]=>
- string(19) "2019-02-15 09:46:20"
- }
- }
- }
- $data = [
- [['email' => 'email1', 'sig' => 'sig1'],.
- ['from' => 'from1'], ['to' => 'to1'], ['sOne' => 's11' , 'sTwo' => 's12']],
- [['email' => 'email2', 'sig' => 'sig2'],.
- ['email' => 'email3', 'sig' => 'sig3'],
- ['email' => 'email4', 'sig' => 'sig4'],
- ['from' => 'from2'], ['to' => 'to2'], ['sOne' => 's21' , 'sTwo' => 's22']],
- ];
- $result = [];
- foreach($data as $d){
- [$from, $to, $s] = array_splice($d, count($d) - 3);
- $first = array_shift($d);
- $result[] = $first + $from + $to + $s;
- $result = array_merge($result, $d);
- }
- $f = fopen("./data/csv.csv", "w");
- foreach($result as $l){
- fputcsv($f, $l);
- }
- email1,sig1,from1,to1,s11,s12
- email2,sig2,from2,to2,s21,s22
- email3,sig3
- email4,sig4
Add Comment
Please, Sign In to add comment