Skip to content

Instantly share code, notes, and snippets.

@charlestati
Created March 23, 2015 06:42
Show Gist options
  • Select an option

  • Save charlestati/7d5f3eeaf1e8f0047045 to your computer and use it in GitHub Desktop.

Select an option

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