Skip to content

Instantly share code, notes, and snippets.

@mattsah
Created May 11, 2013 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mattsah/5561492 to your computer and use it in GitHub Desktop.
Save mattsah/5561492 to your computer and use it in GitHub Desktop.
prettify var_export for php 5.4
$config = preg_replace('#=>\s*array \(#', '=> [', $config);
$config = preg_replace('#\),#', '],', $config);
$config = preg_replace('#,(\s*)\]#', '$1]', $config);
$config = preg_replace('#\d+ => #', '', $config);
$config = preg_replace('#\[\s+\]#', '[]', $config);
$config = str_replace(' ', "\t", $config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment