Last active
March 17, 2021 09:14
-
-
Save AlekVolsk/faa8d9ab6def28935533e7530b3d3279 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function vd(...$args) | |
{ | |
print_r('<pre style="margin:0;padding:20px;font:14px/1.6 Consolas,monospace;' . | |
'background-color:#eee;color:#333">===<br>'); | |
foreach ($args as $i => $context) { | |
if ($i > 0) { | |
print_r('<br>===<br><br>'); | |
} | |
print_r('<b>Parameter ' . $i . ' (' . gettype($context) . '):</b><br>'); | |
if (!(bool)$context) { | |
var_dump($context); | |
} else { | |
print_r($context); | |
} | |
} | |
print_r('<br>===</pre>'); | |
} | |
function vdr(...$args) | |
{ | |
ob_start(); | |
vd($args); | |
return ob_get_clean(); | |
} | |
function savefile($fname, $val) | |
{ | |
$file = fopen($fname, 'w'); | |
fwrite($file, print_r($val, true)); | |
flush(); | |
fclose($file); | |
} | |
function savetempfile($val) | |
{ | |
$file = fopen(\Joomla\CMS\Factory::getConfig()->get('tmp_path') . '/dump.log', 'w'); | |
fwrite($file, print_r($val, true)); | |
flush(); | |
fclose($file); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment