Need to get line number in text file matching string
<p>I need to get the line number of a text file using PHP. The line I need is "WANT THIS LINE".</p>

<p>I tried using file() to put the file lines in an array and search using array_search() but it won't return the line number. In this example I would need to return 3 as the line number.</p>

<pre><code>$file = file("file.txt");
$key = array_search("WANT", $file);
echo $key;
</code></pre>

<p>Text File:</p>

<pre><code>First Line of Code
Some Other Line
WANT THIS LINE
Last Line
</code></pre>
