Jump to content

[SOLVED] delete x lines of a csv


ThunderAI

Recommended Posts

<?php

$num_to_remove = 3;

$file = file($filename);

// php5 only
file_put_contents($filename, implode("\n", array_slice($file, $num_to_remove)));

// php4
/*
$open = fopen($filename, 'w');
fwrite($open, implode("\n", array_slice($file, $num_to_remove)));
fclose($open);
*/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.