note 48798 modified in language.variables by danbrown

From: Date: Sun, 20 Jul 2008 16:09:44 +0000
Subject: note 48798 modified in language.variables by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142158@lists.php.net to get a copy of this message
You can also construct a variable name by concatenating two different variables, such as: <?php $arg = "foo"; $val = "bar"; //${$arg$val} = "in valid"; // Invalid ${$arg . $val} = "working"; echo $foobar; // "working"; //echo $arg$val; // Invalid //echo ${$arg$val}; // Invalid echo ${$arg . $val}; // "working" ?> Carel --was-- You can also construct a variable name by concatenating two different variables, such as: <? $arg = "foo"; $val = "bar"; //${$arg$val} = "in valid"; // Invalid ${$arg . $val} = "working"; echo $foobar; // "working"; //echo $arg$val; // Invalid //echo ${$arg$val}; // Invalid echo ${$arg . $val}; // "working" ?> Carel http://php.net/manual/en/language.variables.php

« previous php.notes (#142158) next »