Return to Snippet

Revision: 51718
at October 1, 2011 21:34 by alberomo


Initial Code
function getVars($arrVars){
     $txtGetVars='';
	foreach ($arrVars as $Key=>$Value){
			if (gettype($Value)=='array'){
				for($k=0; $k <= count($arrVars[$Key])-1;$k++){
					$txtGetVars .= ($txtGetVars=='')? $Key.'[]='$arrVars[$Key][$k] :'&'.$Key.'[]='.$arrVars[$Key][$k];
				}
				else{
					$txtGetVars .=($txtGetVars=='')? $Key.'='.$Value :'&'.$Key.'='.$Value ;
				}		
			}
		}
		return $txtGetVars;

}

Initial URL

                                

Initial Description
Transform $_GET or $_POST in a string to add to an URL and send variables and values.
Argument: Receive an $_GET O $_POST array function.
Returns: variables concatenation to add to the URL.

Initial Title
getVars Function for PHP.

Initial Tags
php

Initial Language
PHP