public static function phpToMarkup($php, $charset = 'utf-8')
{
$regexes = array('@(<(?!\\?)(?:[^>]|\\?>)+\\w+\\s*=\\s*)(\')([^\']*)<' . '?php?(.*?)(?:\\?>)([^\']*)\'@s', '@(<(?!\\?)(?:[^>]|\\?>)+\\w+\\s*=\\s*)(")([^"]*)<' . '?php?(.*?)(?:\\?>)([^"]*)"@s');
foreach ($regexes as $regex) {
while (preg_match($regex, $php, $matches)) {
$php = preg_replace_callback($regex, array('phpQuery', '_phpToMarkupCallback'), $php);
}
}
$regex = '@(^|>[^<]*)+?(<\\?php(.*?)(\\?>))@s';
//preg_match_all($regex, $php, $matches);
//var_dump($matches);
$php = preg_replace($regex, '\\1<php><!-- \\3 --></php>', $php);
return $php;
}