-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump.php
More file actions
63 lines (52 loc) · 1.93 KB
/
dump.php
File metadata and controls
63 lines (52 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/*
xmetrix@xmxstudio.com
a simple function you can use to inspect variable values. who knows if its helpful or not. Whatever right?
usage: include 'dump.php'; //include this file in your php file
then you can test it like this:
<?php
include 'dump.php';
$test = "HI!";
$num = 1203;
$array = Array('hello','world',$test,$num,$num+52);
dump($test);
dump($num);
dump($array);
?>
*/
?>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$(document).ready(function(){
$('.dispose').click(function(){
$(this).parent().fadeOut();
})
$('.variable_name').click(function(){
$(this).next().toggle();
});
$('.value').click(function(){
$(this).children(0).toggle();
});
});//document ready
</script>
<style>.value{display:none;background-color: #c0c0c0;padding: 3px 0 0 5px;cursor: pointer;}.vardump{display:none;background-color: #666; color: #fff;border-radius: 6px;border: solid 1px #333;padding:2px;}.variable{border-radius: 6px;border: solid 1px #333;padding:2px;margin: 5px;background-color: #ccc;}
.variable_name{border-radius: 6px;border: solid 1px #000;padding: 2px;background-color: #333;color: #fff;font-size: 0.85em;}
.variable_name:hover{background-color: #777}
.dispose{float: right;background-color: #c0c0c0;border-radius: 3px;border: solid 1px #000;font-size: 0.6em;font-weight: bold;padding: 5px 5px 4px 5px;cursor: pointer;}.dispose:hover{background-color: #000;color: #c0c0c0;}</style>
<?php
$dumpenabled = true;
function dump($var2dump){
global $dumpenabled;
if($dumpenabled){
foreach($GLOBALS as $var => $value){
if($value === $var2dump){
echo "<div class='variable'><div class='dispose'>x</div><div class='variable_name'>$$var</div><div class='value'>";
echo $var2dump ? $var2dump : "null";
echo "<div class='vardump'>";
var_dump($var2dump);
echo "</div></div></div>";
}
}
}
}//dump
?>