Skip to content

Instantly share code, notes, and snippets.

@SamuelDavis
Created August 16, 2017 19:23
Show Gist options
  • Save SamuelDavis/9d9bc0d500414bd73501fc81bddeaaf2 to your computer and use it in GitHub Desktop.
Save SamuelDavis/9d9bc0d500414bd73501fc81bddeaaf2 to your computer and use it in GitHub Desktop.
Pretty-print something into a php 5.6-parsable array
<?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