functions : Added varDump function and use it in LSdebug function

This commit is contained in:
Benjamin Renard 2009-11-11 19:53:49 +00:00
parent 9ddb6c17e2
commit 791e20be74

View file

@ -208,13 +208,18 @@ function return_data($data) {
return $data; return $data;
} }
function varDump($data) {
ob_start();
var_dump($data);
$data=ob_get_contents();
ob_end_clean();
return $data;
}
$GLOBALS['LSdebug_fields']=array(); $GLOBALS['LSdebug_fields']=array();
function LSdebug($data,$dump=false) { function LSdebug($data,$dump=false) {
if ($dump) { if ($dump) {
ob_start(); $GLOBALS['LSdebug_fields'][]=varDump($data);
var_dump($data);
$GLOBALS['LSdebug_fields'][]=ob_get_contents();
ob_end_clean();
} }
else { else {
if (is_array($data)||is_object($data)) { if (is_array($data)||is_object($data)) {