Page 1 of 1

How can find var is used in file require / include ?

Posted: Tue Dec 23, 2008 11:17 am
by hitmanmx
ex:
a.php

Code: Select all

 
$a = 1;
$b = 2;
 
b.php

Code: Select all

 
require('a.php')
//How can find var is used in file require / include ?
 

Re: How can find var is used in file require / include ?

Posted: Tue Dec 23, 2008 11:22 am
by andyhoneycutt
I'm pretty sure you're looking for the get_defined_vars function. It returns an associative array of all defined variables.

-Andy

Re: How can find var is used in file require / include ?

Posted: Tue Dec 23, 2008 11:46 am
by Mark Baker
The way to find if a particular variable (e.g. $a) is used in a particular included file (e.g. file1.php) is to open that file in a text editor and search for $a.
Of course, if you're using variable variables, then you won't find it.

Re: How can find var is used in file require / include ?

Posted: Tue Dec 23, 2008 7:50 pm
by hitmanmx
andyhoneycutt wrote:I'm pretty sure you're looking for the get_defined_vars function. It returns an associative array of all defined variables.

-Andy
Mark Baker wrote:The way to find if a particular variable (e.g. $a) is used in a particular included file (e.g. file1.php) is to open that file in a text editor and search for $a.
Of course, if you're using variable variables, then you won't find it.
i think fopen and search string too hard.
thk all for help