added debug functions

This commit is contained in:
tp_dhu 2025-05-10 15:25:02 +01:00
parent 04f6f50f28
commit 916657e09c
2 changed files with 27 additions and 4 deletions

26
app/debug.php Normal file
View File

@ -0,0 +1,26 @@
<?php
function debug_print($obj)
{
printf('<pre>%s</pre>', print_r($obj, 1));
}
function debug_var_dump($obj)
{
printf('<pre>%s</pre>', var_dump_str($obj));
}
function var_dump_str()
{
$argc = func_num_args();
$argv = func_get_args();
if ($argc > 0) {
ob_start();
call_user_func_array('var_dump', $argv);
$result = ob_get_contents();
ob_end_clean();
return $result;
}
return '';
}

View File

@ -1,9 +1,6 @@
<?php <?php
function debug_print($obj) require '../app/debug.php';
{
printf('<pre>%s</pre>', print_r($obj,1));
}
require '../lib/autoload.php'; require '../lib/autoload.php';