1

Keep learning PHP. Now I got a data from site out as a formatted text using regex. Every string is in a new line in both files. Content of the first file:

John
Egor
Tim
Laura

Content of the second file:

18
23
48
33

Need to print it out like this:

John  18
Egor  23
Tim   48
Laura 33

Code of the first file:

//..some regex action here ..
 foreach ($names as $name) {
        echo "$name"; 
    }

Where I should include this file? :

//..some regex action here ..
foreach ($numbers as $nr) {
    echo "$nr"; //printing
}
Brock
  • 161
  • 7
  • If `//..some regex action here ..` is for getting the file into an array, just use: `$array = file("yourFile.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);` – Rizier123 Jan 08 '16 at 16:13

0 Answers0