note 71170 deleted from language.references.arent by tularis

From: Date: Wed, 15 Nov 2006 09:02:29 +0000
Subject: note 71170 deleted from language.references.arent by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119741@lists.php.net to get a copy of this message
Note Submitter: Tomek Perlak [tomekperlak at tlen pl] Reason: bad code ---- I needed a function to set a few globals for me. The globals had very long names (to be somewhat unique), so the function started to look really ugly. Using a reference helped me to clean up the code a little. Here's an interesing way of using references with globals - in a bit of a 'pointer-like' way. <? function f1() { global $g_B, $g_C; $v =& $g_B; $v = 91; $v =& $NULL; $v =& $g_C; $v = 45; $v =& $NULL; } f1(); echo $g_B . ", " . $g_C; ?> The result is: 91, 45 Btw, does it really matter how much the references are like or unlike pointers? As long as they work... :)

« previous php.notes (#119741) next »