note 30018 deleted from language.variables by nlopess

From: Date: Fri, 24 Dec 2004 20:33:31 +0000
Subject: note 30018 deleted from language.variables by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-82274@lists.php.net to get a copy of this message
Note Submitter: phValue at example dot com ---- php shows up a var-name conflict if you use the same name for scalar values and arrays: first we want to use a scalar value: $scalarValue = 5; scalarValue holds: 5 But than, you want to use the same name for an array, too, which seems ok at first glimps: (sometimes, its hard to find new names for the same purpose..) $scalarValue = array(); array_push($scalarValue,3); scalarValue[0] holds: 3 now, all seems ok, since the array assignment went well.. but, where is the scalarValue gone, if we ask for it? if you echo for it, you ask for the array: scalarValue holds: $Array The scalar value has no longer a reference, since it shares the same name with an array.. such a bug can give you some hard time to dig for!

« previous php.notes (#82274) next »