Ok see if you can understand this:
$main_page_data is mixed html/php code like your average php webpage.
//notice these use the exact same pattern...
preg_match_all ("/<\?(.+?)\?>/s",$main_page_data,$matches);
preg_replace ("/<\?(.+?)\?>/s",'<BREAK>',$main_page_data);
$main_page_data = $main_page_data.'<BREAK>';
//this failed, php code was not replaced
echo $main_page_data;
//this worked, all the php code is printed out perfectly
foreach ($matches[1] as $match) {
highlight_string('<?'.$match.'?>');
echo "\n<br><br><br>\n";
}
Why the discrepency?
Celia
$main_page_data is mixed html/php code like your average php webpage.
//notice these use the exact same pattern...
preg_match_all ("/<\?(.+?)\?>/s",$main_page_data,$matches);
preg_replace ("/<\?(.+?)\?>/s",'<BREAK>',$main_page_data);
$main_page_data = $main_page_data.'<BREAK>';
//this failed, php code was not replaced
echo $main_page_data;
//this worked, all the php code is printed out perfectly
foreach ($matches[1] as $match) {
highlight_string('<?'.$match.'?>');
echo "\n<br><br><br>\n";
}
Why the discrepency?
Celia