Re: [PHP-DEV] PHP 4.0 Bug #4658: global parameters in class From: Teodor Cimpoesu (teo <email protected>)
Date: 05/29/00

Hi chedong!
On Mon, 29 May 2000, chedong <email protected> wrote:

> From: chedong <email protected>
> 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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>