Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Rob Lang http://www.maison-de-stuff.net/rob/

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Using cycling through input variables in PHP using foreach

This is a simple mechanism for cycling through all the inputs to a PHP script. If you're using $_GET (variables in the query string), $_POST (variables posted with a POST method on a form) or even $_SESSION (variables stored in the session) you can use this technique.

This snippet prints out all the variables in the $_GET variable (the query string) .

   1  
   2  foreach ($_GET as $key => $value)
   3  {
   4  print "$key has a value of $value";
   5  }
   6  
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS