Jan Lehnardt wrote: > [...] > * Constants. > > The Zend Engine 2.0 introduces per-class constants. > > Example: > > <?php > class Foo { > const constant = 'constant'; > } > > echo 'Foo::constant = ' . Foo::constant . "\n"; > ?> > > Old code that has no user-defined classes or functions > named 'const' will run without modifications. > > [...]
thanks, but i think constants are not the same as readonly variables!! a constant - as the name sais - are values that should never be changed. but in my example <?php $doc = new DomDocument(); $root = new DomElement("root"); $root->tagName = "test"; // this, of course, doesn't work... print($root->tagName); $root = $doc->appendChild($root); ?> the constructor (/another class-) function of DomElement has to set the object variable $root->tagName to "root", of course. this is why tagName isn't defined as constant... further you CAN read $root->tagName, but not set it - so it is a real READONLY variable, define in C-Code of Zend Engine... anyway, thanks a lot... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php