Created
August 16, 2017 19:23
-
-
Save SamuelDavis/9d9bc0d500414bd73501fc81bddeaaf2 to your computer and use it in GitHub Desktop.
Pretty-print something into a php 5.6-parsable array
This file contains 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 | |
function pretty($thing) | |
{ | |
return str_replace([ | |
'{', '}', ':', | |
], [ | |
'[', ']', ' =>', | |
], json_encode($thing, JSON_PRETTY_PRINT)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment