how to extract data from my files
Posted: Wed Jan 05, 2005 6:50 am
Hello people
I would like to run the following test on my PHP files.
I have 2 PHP functions called: iterate and display
here are the function signatures:
$param1, $param2 and $param3 are all strings
I would like to know exactly where I am using these functions in the code and what parameters are being used.
I would like to write a script that will iterate over all the PHP files (.php or .inc.php extension) in my projet and to use a regular expression to look for usage of these functions.
Whenever a usage is encountered, it should be written to a log file like so:
<$param1>\t<$param2>\t<path to file>\t<line #>\n
For example, if file a.php contains the code:
and file b.php contains the line:
The log file read:
where 14 is the line in a.php where the function was found and 20 is the line in b.php where the second function was found
I was wondering if someone could help me with this as my main problem is how to formulate the regular expression
regards
I would like to run the following test on my PHP files.
I have 2 PHP functions called: iterate and display
here are the function signatures:
Code: Select all
public function iterate($param1, $param2, $param3 = '');
function display($param1, $param2, $param3 = '');I would like to know exactly where I am using these functions in the code and what parameters are being used.
I would like to write a script that will iterate over all the PHP files (.php or .inc.php extension) in my projet and to use a regular expression to look for usage of these functions.
Whenever a usage is encountered, it should be written to a log file like so:
<$param1>\t<$param2>\t<path to file>\t<line #>\n
For example, if file a.php contains the code:
Code: Select all
echo display('test', 'Hello');Code: Select all
if ($obj->iterate('run', $val) == true)) {Code: Select all
test Hello a.php 14
run $val b.php 20I was wondering if someone could help me with this as my main problem is how to formulate the regular expression
regards