Return to Snippet

Revision: 42831
at March 11, 2011 04:06 by mikael12


Initial Code
/* initvar()
 * Initialize variables 
 */ 
function initvar() {
	foreach( func_get_args() as $v )
	{
		if( is_array( $v ) )
		{
			while( list( $key, $value ) = each( $v ) )
			{
			$GLOBALS[$key] = ( !isset($GLOBALS[$key]) ? $value : $GLOBALS[$key] );
			}
		}
		else
		{
			$GLOBALS[$v] = ( !isset($GLOBALS[$v]) ? '' : $GLOBALS[$v] );
		}
	}
}

Initial URL
http://www.digitalamit.com/article/initvar/2.phtml

Initial Description
Credit goes to Amit Arora

Initial Title
Initializing Variables in PHP

Initial Tags


Initial Language
PHP