You guys really got me going in the right direction a while ago.
I have a huge html file and I wanted to be able to output the contents of the file using echo. Suggestion from forum was to use file_get_contents(). Worked like a champ!
So, in this huge html file I have a string (used like a delimiter) for each section, each section is a row, or rowspan. I wanted to just get that piece between the delimeters. Here is the setup to do just this. It finds 1st string, 2nd string, then returns a string of all the text inbetween... TextBetween function courtesy of 'mvp at mvpprograms dot com'.
<?php
$linenum='';
$content='';
$linenum = file_get_contents("myhtmlfile.html");
echo "<table>";
echo (TextBetween('<!-- Line# 23 -->','<!-- Line# 24 -->',$linenum ));
echo "<table/>";
function TextBetween($s1,$s2,$s){
$s1 = strtolower($s1);
$s2 = strtolower($s2);
$L1 = strlen($s1);
$scheck = strtolower($s);
if($L1>0){$pos1 = strpos($scheck,$s1);} else {$pos1=0;}
if($pos1 !== false){
if($s2 == '') return substr($s,$pos1+$L1);
$pos2 = strpos(substr($scheck,$pos1+$L1),$s2);
if($pos2!==false) return substr($s,$pos1+$L1,$pos2);
}
}
?>