Archived
1
0
Fork 0
This repository has been archived on 2026-04-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
httpcb/app/library/Debug.php
2023-04-30 16:52:38 +02:00

27 lines
645 B
PHP

<?php
namespace Httpcb;
class Debug
{
public static function dump($var, $label = null, $echo = true)
{
// format the label
$label = ($label === null) ? '' : rtrim($label) . ' ';
// var_dump the variable into a buffer and keep the output
ob_start();
var_dump($var);
$output = ob_get_clean();
// neaten the newlines and indents
$output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);
$output = '<pre>'
. $label
. $output
. '</pre>';
if ($echo) {
echo $output;
}
return $output;
}
}