0

I need help. I have a file that include numbers:

105 5001 5450 1548

5158 7875 8785 2404

5410 1548 0 0

Now should read from this file then save number of a line and apart that (where it has space between numbers.)and save it on Variable. For Example: fist line:

$o = 105    $s=5001    $j=5450    $m=1548 

1 Answers1

0

I hope i got your question right. This might help

<?php
$handle = fopen("inputfile.txt", "r");
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        list($o, $s, $j, $m) = explode(' ', $line);
        // do soethings with your variables $o, $s, $j, $m
    }
} else {
    // error opening the file.
}
fclose($handle);
flec
  • 2,891
  • 1
  • 22
  • 30