From 916657e09c652f8076e4a7840bcf570730a91c52 Mon Sep 17 00:00:00 2001 From: tp_dhu Date: Sat, 10 May 2025 15:25:02 +0100 Subject: [PATCH] added debug functions --- app/debug.php | 26 ++++++++++++++++++++++++++ public/index.php | 5 +---- 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 app/debug.php diff --git a/app/debug.php b/app/debug.php new file mode 100644 index 0000000..47ceb9d --- /dev/null +++ b/app/debug.php @@ -0,0 +1,26 @@ +%s', print_r($obj, 1)); +} + +function debug_var_dump($obj) +{ + printf('
%s
', 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 ''; +} diff --git a/public/index.php b/public/index.php index c345e1a..1501394 100644 --- a/public/index.php +++ b/public/index.php @@ -1,9 +1,6 @@ %s', print_r($obj,1)); -} +require '../app/debug.php'; require '../lib/autoload.php';