I need a REGEX that can find blocks of PHP code in a file. For example:
<? print '<?xml version="1.0" encoding="UTF-8"?>';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<?php echo "stuff"; ?>
</head>
<html>
When parsed would by the REGEX would return:
array(
"<? print '<?xml version=\"1.0\" encoding="UTF-8"?>';?>",
"<? echo \"stuff\"; ?>"
);
You can assume the PHP is valid.