I would simply load the file into a string and use explode to break it up into an array of functions based on the word "Function"
<?php
$TheString="function html_header($title){
//bunch of code
}
function html_footer($title){
//bunch of code
}
function html_side($title){
//bunch of code
}";
$TheArray=explode("function",$TheString);
for($Counter=1;$Counter<count($TheArray);$Counter++){
print "function".$TheArray[$Counter]."//Your Comments at the end<br>";
}
?>
of course you'll have to make it so the word "function" is not case sensitive since not everyone uses all lower case.
Also, when printing this out to a php page as the example does, the variables in the function, "$title" for example will not show up as the variable, but as the variable value. But from what I can guess you are not printing this out to a browser, but are just I/O with afile so that shouldn't be a problem.