Skip to content

Instantly share code, notes, and snippets.

@charlestati
Created March 23, 2015 06:42
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 charlestati/7d5f3eeaf1e8f0047045 to your computer and use it in GitHub Desktop.
Save charlestati/7d5f3eeaf1e8f0047045 to your computer and use it in GitHub Desktop.
Create variables from POST values
$variables = array('username', 'age', 'city', 'street');
foreach($variables as $key) {
if(!empty($_POST[$key])) {
${key} = $_POST[$key];
} else {
${key} = '';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment