This loop doesn't seem to be finding the lines I want it to (it's not finding anything at all actually).
$file_lines = file("rss.xml");
$max_lines = count($file_lines);
$id = $_POST['id_number'];
$start_string = " <!--".$id."-->";
$start_line;
$end_string = "<!--end of item ".$id."-->";
$end_line;
for ($i = 0; $i < $max_lines; $i++) {
$temp_line = $file_lines[$i];
if ($temp_line == $start_string) {
$start_line = $i;
echo "found start";
}
if ($temp_line == $end_string) {
$end_line = $i;
echo "found end";
}
}
It's supposed to be going through a file line-by-line and looking to see if it matches a preset string. If it does, it is supposed to set a variable to the position of the line (the counter $i).