Here, for example, I sparsil playlist and I need the first 3 lines in it, how can I get them? Given that the length of the lines is always different.

  • 3
    An example of the original line would not hurt to publish. - Edward
  • Playlist on the disc? Then file () - Total Pusher

1 answer 1

If necessary from the string variable $ text - then something like this:

$text = preg_replace('/^\s+/','',$text); $array = explode("\n",$text,4); /* $array - массив, в котором первые три єлемента - три строки, а четвёртый - остаток строки */ 
  • so the fact of the matter is, I know how from the file I don’t need from the file I need from the variable that came out of the curl - Vasily Kristov
  • Then something like this: $ array = explode ("\ n", $ text); - Confireus
  • Corrected the answer - gave an example code - Confireus