нельзя создать атрибут класса

  • Автор темы Автор темы @rt
  • Дата начала Дата начала

@rt

Новичок
нельзя создать атрибут класса

Почему нельзя создать атрибут $dir класса bla?

class bla{
var $dir = $_SERVER["DOCUMENT_ROOT"];
.
.
.


Заранее благодарю.
 
Note: In PHP 4, only constant initializers for var variables are allowed. To initialize variables with non-constant values, you need an initialization function which is called automatically when an object is being constructed from the class. Such a function is called a constructor (see below).
 
Сверху