Skip to content

Instantly share code, notes, and snippets.

@jesders
Created April 15, 2020 16:17
Show Gist options
  • Save jesders/1a3155dd2c5eb7d0a7c36f81993af2f1 to your computer and use it in GitHub Desktop.
Save jesders/1a3155dd2c5eb7d0a7c36f81993af2f1 to your computer and use it in GitHub Desktop.
Grab all $_POST variables and build an array
<?php
$posts = array();
foreach($_POST as $key => $value):
// if(!in_array($key, $_POST) && !empty($value)) {
// $posts[$key] = $value;
// }
if(!in_array($key, $_POST)) {
$posts[$key] = $value;
}
endforeach;
var_dump($posts);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment