Re: [PHP4BETA] Two questions:

From: Date: Thu, 13 Apr 2000 20:17:30 +0000
Subject: Re: [PHP4BETA] Two questions:
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-13523@lists.php.net to get a copy of this message
Colin Viebrock wrote: > 1) Can I not use set_file_buffer() when opening a pointer to STDOUT? > If not, how can disable write buffering? > > 2) What exactly are the differences with classes between PHP3 and PHP4? > We are porting several scripts over, and they fail for various reasons. > > A simple script that fails is: > > <? > $FOO = "hello"; > class test { > var $bar = $FOO; <<-- this line generates the error > function show() { > echo $this->bar; > } > } > $a = new test; > $a->show(); > ?> > > Other scripts that have a auto_prepended file that include()s other files > that each have class definitions also fail with other errors (mostly about > "nesting" even though there is none). > I don't think you can do var $foo = $somevariable. Doesn't really make sense to me anyways. I would think that the scope of variables in class test does not intertwine with the scope of outside variables. Try: <? class test { var $bar; function test($f) { $this->bar = $f; } function show() { print $this->bar; } } $a = new test("hello"); $a->show(); ?>

« previous php.version4 (#13523) next »