Skip to content

Instantly share code, notes, and snippets.

@allen501pc
Created October 27, 2012 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allen501pc/3964650 to your computer and use it in GitHub Desktop.
Save allen501pc/3964650 to your computer and use it in GitHub Desktop.
Transform all variables of _POST or _GET arries into global variables.
<?php
/*
* Author: Allen ( allen501pc@gmail.com )
* Date: October 27, 2012.
* Description: Transform all variables of _POST or _GET arries into global variables.
* For example, if you want to get a variable from _GET array with index 'regist', you should use $_GET['regist'] to get that.
* Now we use the following transformation codes, then you can just use $regist to get the content.
* Note that the basic idea is from http://goo.gl/Vuxhj
*/
// Transform the _POST array.
foreach($_POST as $Key => $Value) {
$$Key=$Value;
}
// Transform the _GET array.
foreach($_GET as $Key => $Value) {
$$Key=$Value;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment