Posted 19 April 2006 - 01:31 PM
This is the situation. I have a script that somebody else wrote. This guy has a main.php page that includes different .php pages. Those .php pages include other .php pages, and those include OTHER .PHP PAGES! in my opinion, the code is a mess! I've been trying my best to come up with the logic of all these pages put together, but it's riduclous... oh well... can anybody help with some kind of function that reads all variables that are passed on/included to the main.php page? it would be nice to enter a function that gives you a list of all the variables that are in play from those pages on main.php somewhere. Please help.
Posted 19 April 2006 - 01:58 PM
If I'm right, then what you need to do is work through your code logically, and carefully.
Start with main.php.
When you find an include('file.php') go to that file, copy the code and paste it into main.php in place of the include... then do the same for the next include, and the next and the next, and so on.
Eventually you'll have one very large main.php file which is easy to follow through and see what is doing what, and you can then split it down and include parts of it as you want to, rather than how it was put together in the first place.
Posted 20 April 2006 - 01:45 PM
foreach ($GLOBALS as $k => $v)
echo "\$GLOBALS[$k] => $v <br>";
That seems to do the trick, except for the variables that are arrays, but I guess I can loop into it, I just don't need them. Thanks for the advice.
Posted 20 April 2006 - 01:57 PM
Posted 20 April 2006 - 02:20 PM
<?php echo '<pre>' . print_r($GLOBALS,true) . '</pre>'; ?>This will do the "right thing" for the arrays and recursive arrays which exisit in the $GLOBALS array.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users