Skip to content

Commit 3ac86a9

Browse files
committed
fix params type error
1 parent b459f92 commit 3ac86a9

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/Helper/PhpHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public static function printVars(...$args): string
224224
$string = '';
225225

226226
foreach ($args as $arg) {
227-
$string .= print_r($arg, 1) . PHP_EOL;
227+
$string .= print_r($arg, true) . PHP_EOL;
228228
}
229229

230230
return preg_replace("/Array\n\s+\(/", 'Array (', $string);

src/func.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@ function vdump(...$vars)
2121
}
2222
}
2323

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+
2445
if (!function_exists('edump')) {
2546
/**
2647
* Dump data like var_dump, will call exit() on print after.

0 commit comments

Comments
 (0)