note 9451 modified in language.variables.variable by danbrown

From: Date: Wed, 24 Jun 2009 17:03:18 +0000
Subject: note 9451 modified in language.variables.variable by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157424@lists.php.net to get a copy of this message
There is no need for the braces for variable object names...they are only needed by an ambiguity arises concerning which part of the reference is variable...usually with arrays. <?php class Schlemiel { var $aVar = "foo"; } $schlemiel = new Schlemiel; $a = "schlemiel"; echo $$a->aVar; ?> This code outputs "foo" using PHP 4.0.3. Hope this helps... - Jordan --was-- There is no need for the braces for variable object names...they are only needed by an ambiguity arises concerning which part of the reference is variable...usually with arrays. class Schlemiel { var $aVar = "foo"; } $schlemiel = new Schlemiel; $a = "schlemiel"; echo $$a->aVar; This code outputs "foo" using PHP 4.0.3. Hope this helps... - Jordan http://php.net/manual/en/language.variables.variable.php

« previous php.notes (#157424) next »