This repository was archived by the owner on Nov 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug.php
More file actions
60 lines (54 loc) · 1.45 KB
/
debug.php
File metadata and controls
60 lines (54 loc) · 1.45 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
<?php
/**
* error_log an object (rather than just a string)
*
* http://justin.ag/technology/writing-to-the-php-error-log-with-var_dump-and-print_r/
*/
if (!function_exists('epr')) :
function epr($x){
error_log( print_r( $x, true ) );
}
endif; // epr()
/**
* error_log an object (rather than just a string)
*
* http://justin.ag/technology/writing-to-the-php-error-log-with-var_dump-and-print_r/
*/
if (!function_exists('evd')) :
function evd($object){
ob_start(); // start buffer capture
var_dump($object); // dump the values
$contents = ob_get_contents(); // put the buffer into a variable
ob_end_clean(); // end capture
error_log($contents); // log contents of the result of var_dump($object)
}
endif; // evd()
/**
* print_r() surrounded by <pre> tags
*/
if (!function_exists('pre_print_r')) :
function pre_print_r($x) {
echo '<pre>';
print_r( $x );
echo '</pre>';
}
endif; // pre_print_r()
/**
* var_dump() surrounded by <pre> tags
*/
if (!function_exists('pre_var_dump')) :
function pre_var_dump($x) {
echo '<pre>';
var_dump( $x );
echo '</pre>';
}
endif; // pre_var_dump()
/**
* alias to evd (based on legacy code Sal Ferrarello has worked on
*/
if (!function_exists('error_logging')) :
function error_logging($x) {
evd($x);
}
endif; // error_logging()
?>