There is a plain text document t.txt. It contains 3 numbers. How to use PHP to get from the file number. And perform a loop.

while ($i <= value3) { $result =''; if ($i%$value1==0) { $result .='F';} if ($i%$$value2==0) { $result .='B';} if (!$result) { $result = $i;} $i++; } 
  • Example of recording in t.txt: 2 5 20 - Vladislav Ilichov
  • Only 3 numbers? or on each line on 3 numbers? - Arsen
  • There are only three numbers in the file - Vladislav Ilichov

1 answer 1

There are many methods, you can simply use the file() function, sample code:

 $datas = file('/path/to/text.txt'); // Осуществим проход массива и выведем содержимое foreach ($datas as $key => $data) { echo $data; }