note 89267 deleted from function.var-dump by danbrown

From: Date: Sat, 28 Feb 2009 20:33:29 +0000
Subject: note 89267 deleted from function.var-dump by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151270@lists.php.net to get a copy of this message
Note Submitter: Svetoslav Marinov ---- <?php /** * A smart dump function which displays the debugging information only for a given list of hosts. * That way if a dump call is forgotten none of your site visitors will see debug info. * * @author Svetoslav Marinov * @license LGPL * @link http://slavi.biz * @param mixed $var * @return void */ function dump($var) { static $known_ips = array( "127.0.0.1", // localhost "192.168.0.1", // Server "192.168.0.2", // Laptop ); $your_dyn_host = 'youruser.homeip.net'; if (in_array($_SERVER['REMOTE_ADDR'], $known_ips) || ($_SERVER['REMOTE_ADDR'] == gethostbyname($your_dyn_host))) { echo "<pre>\n"; if (is_string($var)) { echo $var; } else { var_dump($var); } echo "</pre>\n"; } } ?>

« previous php.notes (#151270) next »