Page 1 of 1

fopen

Posted: Mon May 15, 2006 10:43 am
by NiGHTFiRE
Hey, this isn't really any code that i'll show, but i'm wondering if you somehow can go to a specefic row number using fopen in the file you are editing?

Posted: Mon May 15, 2006 10:58 am
by Burrito
you could split the rows into an array and then use the key to identify the row number go from there.

Posted: Mon May 15, 2006 1:31 pm
by santosj
This is pseudo code, so it may not work.

Code: Select all

$contents = file_get_contents($filename);

$row = explode("\n", $contents);

// to access the specific row use the following (row_you_want - 1)
// if you want row 30, then you would get 29

echo $row[29];

Posted: Mon May 15, 2006 2:02 pm
by NiGHTFiRE
Thanks, i'll try it.

Posted: Mon May 15, 2006 2:49 pm
by alex-weej

Code: Select all

<?php

$file = file('yourfile');

// Echo out line 519
echo $file[519];

?>