0

Imagine you have code that looks like

console.log(functioncall('Bang goes the' + 
' Olufsen (At least I think it does)'));

or

var_dump(functioncall("Please, for me"));

Without having to write a state machine and without running the script, is there a way to get all occurrences of functioncall(everything_up_to_closing_parentheses) in a script file using PHP?

Possible solutions involve RegExp, but I'm FAR from competent enough to write an expression that covers all possibilities.

Luke Madhanga
  • 6,871
  • 2
  • 43
  • 47
  • Get all occurrences of a function without running it you mean? – developerwjk Mar 02 '15 at 20:49
  • @developerwjk Yes, sorry I shall make that clear now – Luke Madhanga Mar 02 '15 at 20:49
  • you wrote **NB: functioncall() has a PHP and JS variant** that has no sense. if you are in js code - only js code is available, if you are in php context only php function could be called. What are you trying to achieve? – Alex Mar 02 '15 at 20:50
  • So you use a php function named 'functioncall()' and also a javascript function named 'functioncall()' ? Man that must make your code confusing. I'd call one of them functioncalljs() or functioncallphp() – greg_diesel Mar 02 '15 at 20:52

0 Answers0