if true go to next line

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eon201
Forum Newbie
Posts: 10
Joined: Thu Nov 01, 2007 3:57 am

if true go to next line

Post by eon201 »

Hi,

Im looking for a function that allows me to get to the nest line of a file that is read if something is true eg...

Code: Select all

$fp = fopen($filename, "r"); //Open the server log
        $content = fread($fp, filesize($filename));     // Read the server log   
        $content = explode("\n", $content); // explode into array   
        $content  = array_reverse($content ); // reverse the array

$a = 2;
if ($a <3 'then goto next line of file'){
then do some stuff in here}

else{}
Can anyone help with this please??

Thanks. Eon201
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

file() may be of interest..

so may array_pop() and/or array_shift() depending on how you alter the code.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

I don't understand 'go to the next line'? You have the contents of the file in an array, just index into/through the array to the line you want.
(#10850)
Post Reply