summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Gass2025-08-28 14:55:11 +0200
committerNathan Gass2025-08-28 14:55:11 +0200
commit7f75fdec333b2f5adb2e4815e523e2b41e3fb264 (patch)
tree7256a2371aecedf0a36370077e5dac5c03b26b40
parent8bd53ac01e8e14c0aaeeef3f8982090fe32d1e5d (diff)
downloaditools-7f75fdec333b2f5adb2e4815e523e2b41e3fb264.tar.gz
itools-7f75fdec333b2f5adb2e4815e523e2b41e3fb264.tar.bz2
itools-7f75fdec333b2f5adb2e4815e523e2b41e3fb264.zip
add print_r argument to it_debug::dump
-rw-r--r--it_debug.class3
1 files changed, 2 insertions, 1 deletions
diff --git a/it_debug.class b/it_debug.class
index 6cad9b5..8284093 100644
--- a/it_debug.class
+++ b/it_debug.class
@@ -120,6 +120,7 @@ static function setup()
* @param $p['color'] Allow color [true]
* @param $p['html'] Allow html [default based on REMOTE_ADDR]
* @param $p['short'] Omit variable names
+ * @param $p['print_r'] Use print_r instead of var_export (no escaping for strings)
* @return String representation of dump
*/
static function dump($args, $p = [])
@@ -170,7 +171,7 @@ static function dump($args, $p = [])
foreach ($args as $arg)
{
$var = array_shift($argnames);
- $item = gettype($arg) == 'resource' || is_array($arg) && isset($arg['GLOBALS']) || is_object($arg) && is_a($arg, "SimpleXMLElement") ? trim(print_r($arg, true)) : trim(var_export($arg, true));
+ $item = gettype($arg) == 'resource' || is_array($arg) && isset($arg['GLOBALS']) || is_object($arg) && is_a($arg, "SimpleXMLElement") || $p['print_r'] ? trim(print_r($arg, true)) : trim(var_export($arg, true));
# Replace PHP 5+ var_export object representation by old readable style
while (preg_match("#(.*\b)(\w+)::__set_state\(array\(([^()]+)\)\)(.*)#s", $item, $regs) && ++$iterations < 100)