$lines = explode(PHP_EOL, $code); $begin = -1; $end = -1; $tab = ''; for ($i = 0; $i < count($lines); $i++) { if ($begin === -1 && preg_match('/(\\s*).*function.*' . $name . '.*/', $lines[$i], $match)) { $begin = $i; $tab = $match[1]; } if ($end === -1 && $begin !== -1 && preg_match('/^' . $tab . '}/', $lines[$i], $match)) { $end = $i; } } $return = ''; if ($begin !== -1 & $end !== -1) { $return = array_splice($lines, $begin, $end - $begin + 1); $return = implode("\n", $return); } return $return; } public static function loadFile($file) { return file_get_contents($file); } } $code = Make::loadFile('kriss_feed.php'); $code = Make::replaceAutoload($code); $code = Make::removeComments($code); $code = Make::replaceRainTpl($code); $code = Make::includeFiles($code); echo $code;