Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Last active January 19, 2023 09:34
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save james2doyle/abfbd4dc5754712bac022faf4e2881a6 to your computer and use it in GitHub Desktop.
Save james2doyle/abfbd4dc5754712bac022faf4e2881a6 to your computer and use it in GitHub Desktop.
A implementation of "dump and die" (dd) for WordPress
<?php
if (!function_exists('dd')) {
function dd($data)
{
ini_set("highlight.comment", "#969896; font-style: italic");
ini_set("highlight.default", "#FFFFFF");
ini_set("highlight.html", "#D16568");
ini_set("highlight.keyword", "#7FA3BC; font-weight: bold");
ini_set("highlight.string", "#F2C47E");
$output = highlight_string("<?php\n\n" . var_export($data, true), true);
echo "<div style=\"background-color: #1C1E21; padding: 1rem\">{$output}</div>";
die();
}
}
@crebs86
Copy link

crebs86 commented Sep 17, 2022

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment