File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ public static function printVars(...$args): string
224
224
$ string = '' ;
225
225
226
226
foreach ($ args as $ arg ) {
227
- $ string .= print_r ($ arg , 1 ) . PHP_EOL ;
227
+ $ string .= print_r ($ arg , true ) . PHP_EOL ;
228
228
}
229
229
230
230
return preg_replace ("/Array \n\s+\(/ " , 'Array ( ' , $ string );
Original file line number Diff line number Diff line change @@ -21,6 +21,27 @@ function vdump(...$vars)
21
21
}
22
22
}
23
23
24
+ if (!function_exists ('pdump ' )) {
25
+ /**
26
+ * Dump data like var_dump
27
+ *
28
+ * @param mixed ...$vars
29
+ */
30
+ function pdump (...$ vars )
31
+ {
32
+ $ trace = debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS , 2 );
33
+
34
+ $ line = $ trace [0 ]['line ' ];
35
+ $ pos = $ trace [1 ]['class ' ] ?? $ trace [0 ]['file ' ];
36
+
37
+ if ($ pos ) {
38
+ echo "CALL ON $ pos( $ line): \n" ;
39
+ }
40
+
41
+ echo Toolkit \Stdlib \Php::printVars (...$ vars ), PHP_EOL ;
42
+ }
43
+ }
44
+
24
45
if (!function_exists ('edump ' )) {
25
46
/**
26
47
* Dump data like var_dump, will call exit() on print after.
You can’t perform that action at this time.
0 commit comments