Re: PHP 4.0 Bug #4658: global parameters in class
| From: | Teodor Cimpoesu | Date: | Mon, 29 May 2000 15:43:36 +0000 |
| Subject: | Re: PHP 4.0 Bug #4658: global parameters in class | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-19695@lists.php.net to get a copy of this message | ||
Hi chedong!
On Mon, 29 May 2000, chedong@yeah.net wrote:
> From: chedong@yeah.net
> Operating system: freebsd
> PHP version: 4.0.0 Release
> PHP Bug Type: Other
> Bug description: global parameters in class
>
> following code runs properly in php3 but failed at line 3 in php4
>
> <?php
> class test {
> var $test = $PHP_SELF;
.................^
AFAIK you can only have constants here
> var $test1 = "ok";
>
> function show_test()
> {
> echo $this->test;
> echo $this->test1;
> }
> }
rewrite it this way:
class test {
function test() {
global $PHP_SELF;
$this->test = $PHP_SELF;
$this->test1 = "ok";
}
/* ... */
}
and it should work
[ erm, you did check the PHP3-4 compatibility issues on www.php.net, didn't you? :) ]
-- teodor