Tommy Pham wrote:
foreach ($_REQUEST as $key =>  $value) $$key = $value;

short-circuited one-liners :)


akk... wrong clicked before I had a chance to fix the code. anyway,

foreach ($_GET as $key =>  $value) if (substr($key, 0, 2) == 'f_')
${'t_'.substr($key, 2)} = $value;

Tommy, excellent.. I had just rewrote your first suggestion:

foreach ($a_formvars as $key => $value) ${str_replace('f_', 't_',$key)} = $value;

(which works)
but I like that you are only affecting the vars that *begin* with $match. I suppose the above would also work with $_REQUEST.

Shawn, I don't know if I have a good reason, other than I rather like
working with string vars instead of array vars from $_REQUEST for
(sticky forms and conditionals). I can check/verify them as well in the process.

Thanks to all that posted.. I always learn from the "skin the cat" game.


D Brooke

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to