Re: file( ) function

From: Date: Wed, 07 Jun 2006 20:03:42 +0000
Subject: Re: file( ) function
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-237572@lists.php.net to get a copy of this message
Yes, that is actually $temp, not $temp1. However, my problem still remains the same. Several lines in the file contain the exact same string as the one I am comparing. I need their positions in the array so that I can operate on other lines in the file. That is why I am using file( ) instead of other file reader functions. Thanks. MM.
$name = $_POST["filename"]; $lines = file($name); $i = 0; $len = sizeof($lines); //echo $i; while($i < $len) { //echo $lines[$i]; $temp = $lines[$i]; $temp = trim($temp); //echo $temp; if($temp1 == '--------------------------------------') { This should be $temp, shoudn't it?
    echo $i;
    return $i;
} else
    $i++;
}


« previous php.general (#237572) next »