Skip to content

Instantly share code, notes, and snippets.

@mkropat
Last active June 3, 2016 08:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkropat/2d1e696e8fbef7f23de2 to your computer and use it in GitHub Desktop.
Save mkropat/2d1e696e8fbef7f23de2 to your computer and use it in GitHub Desktop.
Pretty-print PHP serialized files
#!/usr/bin/env php
<?php
$serialized = file_get_contents($argv[1]);
$obj = unserialize($serialized);
$json_obj = json_encode($obj, JSON_PRETTY_PRINT);
echo "$json_obj\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment