There is a file

https://dl.dropboxusercontent.com/u/8025044/1477559821.600304360.txt

I got it from PDF. Now the task is to parse it. But first you need to be divided into blocks.

screenshot

Tried through explode ('\ n', $ file); but it does not work, because it seems there is no paragraph. How to be?

  • Everything that relates to the question should be in the question, not links to cloud storage - Alexey Shimansky
  • 2
    Probably it was necessary to explode("\n", $file); for in single quotes, \n represents itself and not carriage return - Mike
  • I would divide not by "\ n", but by "\ n \ n", since there is an empty line. - Stanislav
  • It takes two characters: on the empty line and with it. Plus - do not forget that there may be \r\n . - user207618

1 answer 1

 <?php $content = file_get_contents("https://dl.dropboxusercontent.com/u/8025044/1477559821.600304360.txt"); print_r(explode("\n\n", $content)); // Выведет массив, разбитый по параграфам