foreach / Array Loops Filling from $_GET or $_POST

Information for PHP. Hypertext Preprocessor
Post Reply
dzcadii
Posts: 94
Joined: Sun Mar 01, 2015 4:36 am

foreach / Array Loops Filling from $_GET or $_POST

Post by dzcadii » Sun Mar 01, 2015 6:40 pm

/**********************************************************************************************************************************
This way you can work out of the GLOBAL scope. This will allow you to add anything to the array and use
************************************************************************************************************************************/

Code: Select all

<?

$MyArray=array();

//you can switch $_GET with $_POST if you need to
foreach($_GET as $key => $value){
$MyArray[$key]=$value;
}

//and here I simply print out all the elements in the array & you can do what you need to
print_r($MyArray);

?>
Enjoy;
CADII :: :geek:
http://dzsoundnirvana.com/

Post Reply