Skip to content

Instantly share code, notes, and snippets.

@scsskid
Last active August 30, 2019 09:25
Show Gist options
  • Save scsskid/6ca082f6d95379e8f9b8b1a4d3a2bb99 to your computer and use it in GitHub Desktop.
Save scsskid/6ca082f6d95379e8f9b8b1a4d3a2bb99 to your computer and use it in GitHub Desktop.
Debug PHP to Console JSON
<?php
function debug_log($object = null, $label = null)
{
$message = json_encode($object, JSON_PRETTY_PRINT);
$label = "Debug" . ($label ? " ($label): " : ': ');
echo "<script>console.log(\"$label\", $message);</script>";
}
@scsskid
Copy link
Author

scsskid commented Aug 30, 2019

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