note 89267 added to function.var-dump
| From: | SvetoslavMarinov at osu1 dot php dot net | Date: | Sat, 28 Feb 2009 20:30:59 +0000 |
| Subject: | note 89267 added to function.var-dump | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151268@lists.php.net to get a copy of this message | ||
<?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";
}
}
?>
----
Server IP: 216.235.13.26
Probable Submitter: 216.121.132.103
----
Manual Page -- http://www.php.net/manual/en/function.var-dump.php
Edit -- https://master.php.net/note/edit/89267
Del: integrated -- https://master.php.net/note/delete/89267/integrated
Del: useless -- https://master.php.net/note/delete/89267/useless
Del: bad code -- https://master.php.net/note/delete/89267/bad+code
Del: spam -- https://master.php.net/note/delete/89267/spam
Del: non-english -- https://master.php.net/note/delete/89267/non-english
Del: in docs -- https://master.php.net/note/delete/89267/in+docs
Del: other reasons-- https://master.php.net/note/delete/89267
Reject -- https://master.php.net/note/reject/89267
Search -- https://master.php.net/manage/user-notes.php