Hey hassank1. I had fun with this regex, it's a cool idea! I've come up with a regex that produces the output you want:
/^\s*function ([\w\-]*)\((.*)(?=\))\)[\s\r\n]*\{([\w\s\r\n\{\}\$\(\)\=\'\"\!;]*)(?=\}[\s\r\n]*$)/
Using this in PHP:
preg_match('/^\s*function ([\w\-]*)\((.*)(?=\))\)[\s\r\n]*\{([\w\s\r\n\{\}\$\(\)\=\'\"\!;]*)(?=\}[\s\r\n]*$)/', $test_string, $matches
In this case the $matches array will contain: [0]: The whole function matched, [1]: Function Name, [2]: Parameters, [3]: Function body
It's a bit messy and could probably do with some tidying up, but try it and see what you think. If you want it explained just let me know