From the manual:

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).


Cheers

Chris

dirk wrote:

Hello everybody,

can anyone explain to me, why I can't resize an array inside a class?
Sample Code:

<?php
class Liste {
  var $input = array (1,2,3);
  var $input2 = array_pad ($input,10, 1);
}
?>

Output: Parse error: parse error, unexpected '(', expecting ',' or ';' in
/srv/www/htdocs/stundenplan/stpoo.php on line 4


Thanks,
Dirk




-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to