Say I have an HTML document: (Excerpt below with line numbers)
30 - <div id="myDiv">
31 - <span class="mySpan">Some Text</span>
I am using PHP:
$html = file_get_contents('myHtml.html')
I want to find the line number on which a string is found (Let's assume there's only one occurrence of the string in the document), and return the entire contents found on that line. For example,
getLine('myDiv'); //returns <div id="myDiv">
getLine('class="mySpan"'); //returns <span class="mySpan">Some Text</span>
How can I do this? Thank you!