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 | |
// Returns a string containing the type, and value in prettyfied JSON, of the argument. | |
function pretty ($var) { | |
return gettype($var) . ' ' . json_encode( | |
$var, | |
JSON_UNESCAPED_SLASHES | // Don't escape forward slashes. stripslashes() could be used afterwards instead | |
JSON_UNESCAPED_UNICODE | // Print unicode characters insteas of their encoding "€" vs "\u20ac" | |
JSON_PRETTY_PRINT | // Nice layout over several lines, human readable | |
JSON_PARTIAL_OUTPUT_ON_ERROR | // Substitute whatever can not be printed |