GLOBAL in function ...()

From: Date: Thu, 20 Jul 2000 13:31:27 +0000
Subject: GLOBAL in function ...()
Groups: php.general 
Request: Send a blank email to php-general+get-7403@lists.php.net to get a copy of this message
Hello, Is there a way to define all global variables in a function without explicitly writing each variable's name? For example: <? $a = 0; $b = 32; $c = 9; $d = 7; function Check( ) { global $a, $b, $c, $d; if( $a + $b == $c + $d ) { echo "True"; } else { echo "False"; } } function AnotherCheck( ) { global {all global variables}; if( $a + $b == $c + $d ) { echo "True"; } else { echo "False"; } } Check( ); AnotherCheck( ); ?> Both should produce same results, even though the second function didn't explicitly specify each variable's name in "global" definition. Thanks for your help. Noor

« previous php.general (#7403) next »