I'm not sure i understand your problem, but it seems to be that your regex won't parse multiple functions from the $code variable?
Here is a slightly re-written regexp that can handle multiple functions
$code = 'function myfunc1() { echo "This is myfunc1"; } function myfunc2($arg1 = array(), $arg2) { echo "This is myfunc2"; print_r($arg1); }';
preg_match_all("/function\s*([a-zA-Z0-9_]+)\s*\((.*)\)\s*\{(.*)\}/Uis", $code, $functions);
echo '<pre>';
print_r($functions);
echo '</pre>';
And the output
Array
(
[0] => Array
(
[0] => function myfunc1() { echo "This is myfunc1"; }
[1] => function myfunc2($arg1 = array(), $arg2) { echo "This is myfunc2"; print_r($arg1); }
)
[1] => Array
(
[0] => myfunc1
[1] => myfunc2
)
[2] => Array
(
[0] =>
[1] => $arg1 = array(), $arg2
)
[3] => Array
(
[0] => echo "This is myfunc1";
[1] => echo "This is myfunc2"; print_r($arg1);
)
)
This will however run into problems if your function bodies contain the { } characters. I don't think that can be handled by a single regular expression.