是否可以将元素数组作为PHP类的属性?

As this does not seam to work?

class Site {
private $PROPERTIES = array(
           "NAME",'STACKOVERFLOW',
                   "URL",'http:/stackoverflow.com'
                  );


    function __construct() {
            $this->props = $PROPERTIES;
    }
    function dumpData() {
            var_dump($this->props)
    }
}

you can but you missed the way of referencing properties...

instead use:

$this->props = $this->PROPERTIES;

I think what you want it a associative array?

private $PROPERTIES = array(
           "NAME" => 'STACKOVERFLOW',
           "URL" => 'http:/stackoverflow.com'
                  );

At least that is how I understood it. Because that would work.

$this->PROPERTIES['NAME'];

** fixed, thanks guys :P Too early for me...

You don't need $props since you already have $PROPERTIES...

In classes, reference class-level variables from functions using $this :

function __construct() {
        $this->props = $this->PROPERTIES;
}
function __construct() {
        $this->props = $this->PROPERTIES;
}