i want to delete first 5 lines in a text file

Codes here !

Moderators: macek, egami, gesf

brae2009
New php-forum User
New php-forum User
Posts: 1
Joined: Sun May 13, 2012 8:13 am

i want to delete first 5 lines in a text file

Postby brae2009 » Sun May 13, 2012 8:14 am

hello
iam new in php

i want to reed first 5 lines in text file

then i want to delete first 5 lines in a text file "1.txt"

i tried multi codes before

i want to make a iframe from first 5 lines in the text then delete them and update the file



Code: Select all

<?php
$myFile = "1.txt";
$lines = file($myFile);//file in to an array
 {
print "<iframe width=300 height=260 src=" . $line[1] . "></iframe><br />\n";
print "<iframe width=300 height=260 src=" . $line[2] . "></iframe><br />\n";
print "<iframe width=300 height=260 src=" . $line[3] . "></iframe><br />\n";
 }

$File = "1.txt";
 $Handle = fopen($File, 'w');
delete($Handle, $lines[1]);
delete($Handle, $lines[2]);
delete($Handle, $lines[3]);
 fclose($Handle);

 ?>

faust
New php-forum User
New php-forum User
Posts: 109
Joined: Thu May 03, 2012 7:22 am

Re: i want to delete first 5 lines in a text file

Postby faust » Mon May 14, 2012 7:30 am

a new homework has appeared...


Return to “mySQL & php coding”

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest