Created
October 27, 2009 21:28
Revisions
-
erikreagan revised this gist
Oct 27, 2009 . 2 changed files with 3 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,8 @@ <?php // This command simply prints out the serialized data in a readable printed array format // Found on a blog via a google search // @see http://top-frog.com/2009/08/28/quickly-unserialize-data-in-textmate/ $data = unserialize(file_get_contents('php://stdin')); print_r($data); 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ <?php // This command is the "re-serialization" version of my other gist // I needed a way to get my newly edited data back to it's original serialized format so I wrote this // First we create an array with each line (with the exception of the first and last) $string_to_array = explode("\n",file_get_contents('php://stdin')); -
erikreagan revised this gist
Oct 27, 2009 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
erikreagan created this gist
Oct 27, 2009 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/usr/bin/env php <?php // This command is the "re-serialization" version of my other gist // First we create an array with each line (with the exception of the first and last) $string_to_array = explode("\n",file_get_contents('php://stdin')); // We cycle through the array and turn the data into a usable php array foreach ($string_to_array as $line) { if(preg_match("/(\s+)\[/", $line)) { $key = preg_replace("/(\s+\[(.*)\].+)/","$2",$line); $value = preg_replace("/.+(=> (.*)\n?)/","$2",$line); $array_result[$key] = $value; } } // Then we print it back out serialized and ready to be put back wherever it came from echo serialize($array_result); ?> 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ #!/usr/bin/env php <?php // This command simply prints out the serialized data in a readable printed array format $data = unserialize(file_get_contents('php://stdin')); print_r($data); ?>