Skip to content

Instantly share code, notes, and snippets.

@sidor1989
Last active November 10, 2017 09:20
Show Gist options
  • Save sidor1989/b9f3759da9a42764042e8c0be3b44738 to your computer and use it in GitHub Desktop.
Save sidor1989/b9f3759da9a42764042e8c0be3b44738 to your computer and use it in GitHub Desktop.
dumpArrayBitrix
<?
function PR($var, $all = false, $die = false)
{
global $USER;
if(($USER->GetID() == 1) || ($all == true))
{
$bt = debug_backtrace();
$bt = $bt[0];
$dRoot = $_SERVER["DOCUMENT_ROOT"];
$dRoot = str_replace("/","\\",$dRoot);
$bt["file"] = str_replace($dRoot,"",$bt["file"]);
$dRoot = str_replace("\\","/",$dRoot);
$bt["file"] = str_replace($dRoot,"",$bt["file"]);
?>
<div style='font-size:9pt; color:#000; background:#fff; border:1px dashed #000;'>
<div style='padding:3px 5px; background:#99CCFF; font-weight:bold;'>File: <?=$bt["file"]?> [<?=$bt["line"]?>]</div>
<pre style='padding:10px;'><?print_r($var)?></pre>
</div>
<?
}
if($die)
{
die;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment