Re: One more (was Re: [PHP-GTK] Assignment evalution weirdness)

From: Date: Fri, 10 Aug 2001 17:07:28 +0000
Subject: Re: One more (was Re: [PHP-GTK] Assignment evalution weirdness)
References: 1 2  Groups: php.gtk 
Request: Send a blank email to php-gtk+get-2743@lists.php.net to get a copy of this message
On Fri, 10 Aug 2001, Markus Fischer wrote: > In the same context, e.g. in a method from a class extending > GtkWindow: > > // we assume $this->hash = array(); > > var_dump( $this->hash[ 'foo']); // NULL > $test = $this->hash; > var_dump( $test[ 'foo']); // NULL, too, its ok > > if( isset( $test[ 'foo'])) { // works, doesn't enter the if > > // but > > if( isset( $this->hash[ 'foo'])) { // enters the if here Here's my test: class foo extends GtkWindow { function foo() { $this->hash['foo'] = array(); var_dump( $this->hash[ 'foo']); // NULL $test = $this->hash; var_dump( $test[ 'foo']); // NULL, too, its ok if( isset( $test[ 'foo'])) { // works, doesn't enter the if print 'isset( $test[ \'foo\']) worked'."\n"; } // but if( isset( $this->hash[ 'foo'])) { // enters the if here print 'isset( $this->hash[ \'foo\']) worked'."\n"; } } } $obj = new foo; The result: array(0) { } array(0) { } isset( $test[ 'foo']) worked isset( $this->hash[ 'foo']) worked So it works. -Andrei * Marriage is not a word. It's a sentence. Life-long sentence. *

« previous php.gtk (#2743) next »