array passing in URLs, hypothetical example

Top Page
Author: PHP Web Development
Date:  
To: PHP Mailing List
Subject: array passing in URLs, hypothetical example
I found a semi-answer to this from Devshed, but the code from
http://forums.devshed.com/t30062/s.html didn't work. After some
tinkering, here's what I came up with:

[test.php]
<?php
$arrayVar=array("a", "b", "c");
$arrayVar=urlencode(serialize($arrayVar));
header("Location: test2.php?arrayVar=$arrayVar");
?>

[test2.php]
<?php
$arrayVar=unserialize(stripslashes(urldecode($_GET['arrayVar'])));
echo($arrayVar[1]);
//you should see a 'b'
?>

As a note, if the urlencode and urldecode are skipped, the above
seems to produce the same output.
---
The number one hint or tip is this: rolling sushi is a
self-correcting process. If your first roll does not turn out quite
right, eat it to hide the evidence and roll another, which will be
much better.- Mark Hutchenreuther
______________________________________________
PHP Web Development Mailing List
php@??? (#PHP @ irc.free.net.ph)
http://lists.free.net.ph/mailman/listinfo/php
Searchable Archives: http://marc.free.net.ph