I read the note from "stanislav dot eckert at vizson dot de" and I really enjoyed the function he created.
For my use I made some adaptations leaving the function more practical and allowing the passage and multiple parameters at a time, I also modified the style of the <code> element with a black background and margins.
<?php
function hl_export()
{
try {
ini_set("highlight.comment", "#008000");
ini_set("highlight.default", "#FFFFFF");
ini_set("highlight.html", "#808080");
ini_set("highlight.keyword", "#0099FF; font-weight: bold");
ini_set("highlight.string", "#99FF99");
$vars = func_get_args();
foreach ( $vars as $var ) {
$output = var_export($var, true);
$output = trim($output);
$output = highlight_string("<?php " . $output, true); $output = preg_replace("|\\<code\\>|", "<code style='background-color: #000000; padding: 10px; margin: 10px; display: block; font: 12px Consolas;'>", $output, 1); $output = preg_replace("|(\\<span style\\=\"color\\: #[a-fA-F0-9]{0,6}\"\\>)(<\\?php )(.*?)(\\</span\\>)|", "\$1\$3\$4", $output); echo $output;
}
} catch (Exception $e) {
echo $e->getMessage();
}
}
$var1 = 'Example String';
$var2 = 1987;
$var3 = null;
$var4 = true;
$var5 = array('Array', '05', 05, false, null);
hl_export( $var1, $var2, $var3, $var4, $var5 );
?>