I would love to know if you have actually taken the time to write a program and test it? You will find the theoretical does not work in practice, and I don't know why.
Grab a random html page. Name it index.html
<?php
$file = 'index.html';
$fp = fopen($file,'r');
if (!$fp){
echo "Err opening file";
}
$buffer = '';
while (!feof ($fp)){
$buffer .= fgets ($fp,4096);
}
$array = array();
eregi("<[>]>", $buffer, $array);
$x = 0;
while ($array[$x]){
echo "Element: ".$array[$x++]."<BR>\n";
}
?>
Nothing seems to work. <[>]> is logically the correct regexp, but I can't get it to work correctly. Is there something wrong with my creation of the buffer?