Sunday, 15 August 2010

class - php private array access from member function -



class - php private array access from member function -

when run code, "in constructor" beingness printed out.

why not seeing array beingness printed out?

apache log shows no errors. php syntax checkers show no errors.

<?php //---- user class ---- class user { private $list; function __construct() { echo "in constructor"; $this->$list = array(1, 2, 5); } function printall() { print_r($this->$list); } } // end class $foo = new user(); $foo->printall(); ?>

a $ much, seek this

when run code, "in constructor" beingness printed out.

why not seeing array beingness printed out?

apache log shows no errors. php syntax checkers show no errors.

class user { private $list; function __construct() { echo "in constructor"; $this->list = array(1, 2, 5); } function printall() { print_r($this->list); } }

php class

No comments:

Post a Comment