Thanks to Jeff, here's the solution that works for me:
$filecontent = file_get_contents($file); // Parsing the file's contents into a string
$re = '/(?<!\$)(\b\S+?\b)(?=\()/'; // The pattern
preg_match_all($re, $filecontent, $out, PREG_PATTERN_ORDER);
print_r($out[0]);
I'm using a negative lookbehind as suggested by Jeff as well as a positive lookahead checking for a (
after each word, but without making the (
part of the match.
I went for the (
part as that defines a PHP function as far as I'm concerned.
I'm open for improvements! :-) Thanks to Jeff!