Sometimes we are required to do some troubleshooting on a production site.
In order to do that *safely* we'll show debug information only for us.
This could be put into a safe_debug function for later use by the way.
On development/staging servers I recommend installing debuggers such as Zend Debugger, xdebug etc and enabling errors (E_ALL).

[code language="php"]
if ($_SERVER['REMOTE_ADDR'] == '1.2.3.4' || preg_match('#^192.#', $_SERVER['REMOTE_ADDR'])) {
echo "Dev dump";
echo "

";
var_dump($params);
echo "

";
echo __FILE__ . ':' . __LINE__;
}
[/code]

Of course one should be extra careful for opening and closing php tags otherwise this will product fatal errors.

Happy debugging!

Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer