Possible Duplicate:
Parse PHP code to extract function names?
I'm working on a script to read my PHP files and get all the functions as a return.
I'm using preg_split()
to split my file into an array of functions.
I'm having trouble writing the pattern to get all the functions returned (faced issue when the function's name contains the word 'function'. I'm open to any other solutions / advice.
Expected output:
array (
0 => 'function write{$oneparam, $two, $three){return $two}',
1 => 'function read{$oneparam, $two, $tthree){returne $awesome}',
2 => 'function edit{$oneparam, $two, $three){return $two},
3 => 'function delete{$oneparam, $two, $three){return $two}',
4 => 'function lastfunction{$oneparam, $two, $three){return $two}'
)