How to remove first 3 rows in csv file using PHP?

Hello! How to remove first 3 rows in csv file using PHP?
The network has found only one line:
<?php
 $row_number = 0; //the line number which is to be removed
 $file_out = file("file.csv"); // Read entire file into an array 
 //writable for a string in file
 file_put_contents("file2.csv", $file_out[$row_number], FILE_APPEND); 
 //delete a recorded line
 unset($file_out[$row_number]); 
 //recorded ostaco in file
 file_put_contents("file.csv", implode("", $file_out));
?>
June 10th 19 at 14:38
2 answers
June 10th 19 at 14:40
Deleting a row in your code, it's a side effect, its main purpose is the first need a string to save to a new file.
Delete rows easier.
$file_out = file("file.csv"); //read the necessary file
$file = array_splice($file, 3); //deleted 3 rows
file_put_contents("file.csv", implode("", $file)); //save to the same file
June 10th 19 at 14:42
three times do

line for uninstalling always will be first

Find more questions by tags CSVPHP