function quit($dump = null)
{
    if (is_null($dump)) {
        global $spacegame;
        dump_r($spacegame);
    } else {
        dump_r($dump);
    }
    die;
}
Exemplo n.º 2
0
function dump_r_exit($var, $label = 'Dump', $echo = TRUE)
{
    dump_r($var, $label, $echo);
    exit;
}
Exemplo n.º 3
0
{
    $csv = [];
    $rows = array_map('str_getcsv', file($file));
    $header = array_shift($rows);
    foreach ($rows as $row) {
        $csv[] = array_combine($header, $row);
    }
    return $csv;
}
// prevent arrays keyed under 'c' from dumping sub-nodes
Type::hook('_Array', function ($raw, Type $type, $path) {
    if (end($path) === 'c') {
        $type->depth = 1;
    }
    return $type;
});
// prevent anything keyd under 'xxx' from dumping
Type::hook('*', function ($raw, Type $type, $path) {
    if (end($path) === 'xxx') {
        return false;
    }
});
// tag specific keys with addl rend classes
Type::hook('*', function ($raw, Type $type, $path) {
    if (end($path) === 'yyy') {
        $type->classes[] = 'marked';
    }
    return $type;
});
dump_r($stuff);
Exemplo n.º 4
0
function dump()
{
    if (func_num_args() > 0) {
        $args = func_get_args();
        // get the input arg passed to the function
        $src = debug_backtrace();
        $idx = strpos($src[0]['file'], 'Setting.php') ? 1 : 0;
        $src = (object) $src[$idx];
        $file = file($src->file);
        $i = 1;
        do {
            $line = $file[$src->line - $i++];
        } while (strpos($line, 'dump') === false);
        preg_match('/dump\\((.+?)\\)?(?:$|;|\\?>)/', $line, $m);
        $key = $m[1];
        $key = explode(',', $key);
        $dump = [];
        foreach ($args as $k => $n) {
            $dump[$key[trim($k)]] = $n;
        }
        echo '<pre class="dump_r" style="margin-bottom:-17px;position:absolute;width:100%;border-right:0px;border-bottom:0px;"><div class="file-line" style="border:0px;">' . $src->file . " (line {$src->line})</div></pre>";
        dump_r($dump);
    }
}
Exemplo n.º 5
0
			}
		</style>
		<?php 
dump_r($obj, false, true, 2, 1);
?>

		<h2>text-only</h2>
		<pre><?php 
$ascii = dump_r($obj, true, false, 1000.0, 1);
echo htmlspecialchars($ascii, ENT_NOQUOTES);
?>
</pre>

		<h2>limited recursion</h2>
		<pre><?php 
$ascii = dump_r($obj, true, false, 1, 1);
echo htmlspecialchars($ascii, ENT_NOQUOTES);
?>
</pre>

		<h2>native print_r()</h2>
		<pre><?php 
echo print_r($obj, true);
?>
</pre>

		<h2>native var_dump()</h2>
		<pre><? var_dump($obj); ?></pre>

		<a href="https://github.com/leeoniya/dump_r.php"><img style="position: absolute; top: 0; right: 0; border: 0;" src="github_fork.png" alt="Fork me on GitHub"></a>
	</body>