Anonymous
public text v1 · immutable<?php
$myarray = file("somefile.txt");
foreach($myarray as $key => $val)
$myarray[$key ] = str_replace("\n","",str_replace("\r","",$val));
$index = array_search("#</VirtualHost>",$myarray);
if($index === false) //note === with typecheck
echo "string not found";
else {
echo "string found at index : $index in array<br>line is<hr>";
echo $myarray[$index];
}
?>