Created
November 24, 2009 15:43
-
-
Save philsturgeon/241954 to your computer and use it in GitHub Desktop.
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 | |
$array = array( | |
'Appt with my IFA: cxzcsdf Wed. 10:30', | |
'Transfer some cas\\zh to my SIPP ready to invest in R&M Global Opportunities on launch'."\n", | |
'Research and switch from my gilts fund to an emerging markets fund' | |
); | |
$serialized = serialize($array); | |
echo '<strong>Serialized</strong>: ' .$serialized .'<br/><br/>'; | |
$urlencoded = urlencode($serialized); | |
echo '<strong>Encoded:</strong> <a href="?encoded=' .$urlencoded .'">' .$urlencoded .'</a><br/><br/>'; | |
if( isset($_GET['encoded']) ) | |
{ | |
echo '<strong>Encoded from GET:</strong> ' . $_GET['encoded'] .'<br/><br/>'; | |
$decoded = urldecode($_GET['encoded']); | |
echo '<strong>Decoded from GET:</strong> ' . $decoded .'<br/><br/>'; | |
$decoded_array = unserialize($decoded); | |
echo '<strong>Decoded from GET:</strong> ' . print_r($decoded_array, TRUE) .'<br/><br/>'; | |
} | |
echo "<h2>Final verdict!</h2>"; | |
var_dump($array === $decoded_array); | |
echo "<h2>Whhhhhhhy?!</h2>"; | |
var_export($array); | |
echo "<br/><br/>"; | |
var_export($decoded_array); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment