note 70751 deleted from language.variables.scope by tularis

From: Date: Thu, 26 Oct 2006 16:41:24 +0000
Subject: note 70751 deleted from language.variables.scope by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119140@lists.php.net to get a copy of this message
Note Submitter: squeegee Reason: bad code ---- here's an interesting use of global function whatever($prefix){ $a = "${prefix}var1"; $b = "${prefix}var2"; $c = "${prefix}var3"; $d = "${prefix}var4"; global $$a, $$b, $$c, $$d; This lets you reference different sets of variables that are named with a common suffix, but the prefix can change. i.e. 1st time you call it, let's say you want to use variables named $myvar1, $myvar2, $myvar3, $myvar4 and the next time you call it, you want to use variables named $yourvar1, $yourvar2, $yourvar3, $yourvar4

« previous php.notes (#119140) next »