Skip to content

Instantly share code, notes, and snippets.

@yayMark
Created March 14, 2018 08:48
Show Gist options
  • Save yayMark/574758914011f15cfe0ed30299e968e4 to your computer and use it in GitHub Desktop.
Save yayMark/574758914011f15cfe0ed30299e968e4 to your computer and use it in GitHub Desktop.
PHP: output a variable in JSON format
<?php
function spew($var) {
echo '<pre>';
echo json_encode($var, JSON_PRETTY_PRINT);
echo '</pre>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment