josephhh Posted January 26, 2012 Share Posted January 26, 2012 Hi guys, I've a developer for a pretty large website and forum, the database is exploding in size and we are now seeing a grow in the slow log. We want to be able to fix this by optimizing query's but the site is so big, we can't locate the query's themselfs as they are dynamically generated. I want to be able to tail onto the end of the query a comment containing where a function was last called. In the example below, I want the file name and line-number of where add_together() was called. Here is an example for index.php: $a = 1; $b = 2; $c = add_together($a, $b); function add_together($a, $b) { return $a + $b; } Look forward to your assistance with this! Joe Quote Link to comment https://forums.phpfreaks.com/topic/255825-php-variables-where-did-it-come-from/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 26, 2012 Share Posted January 26, 2012 debug_backtrace Quote Link to comment https://forums.phpfreaks.com/topic/255825-php-variables-where-did-it-come-from/#findComment-1311415 Share on other sites More sharing options...
josephhh Posted January 26, 2012 Author Share Posted January 26, 2012 OH MY DAYS, how did i forgot about debug_backtrack -,- I feel so ashamed to call myself a PHP developer. Thanks though! Quote Link to comment https://forums.phpfreaks.com/topic/255825-php-variables-where-did-it-come-from/#findComment-1311416 Share on other sites More sharing options...
Maq Posted January 26, 2012 Share Posted January 26, 2012 Something else that might help - most IDEs have a reference search that allows you to find where the method is called anywhere in your project/workspace. (In eclipse, double click the method and hit ctl+shft+G) Quote Link to comment https://forums.phpfreaks.com/topic/255825-php-variables-where-did-it-come-from/#findComment-1311428 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.