Re: [PHP] Array inside Class

2004-09-10 Thread Greg Donald
On Fri, 10 Sep 2004 20:09:55 +0200, dirk [EMAIL PROTECTED] wrote: 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,

Re: [PHP] Array inside Class

2004-09-10 Thread Chris Dowell
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

Re: [PHP] Array inside Class

2004-09-10 Thread John Holmes
From: dirk [EMAIL PROTECTED] 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

Re: [PHP] Array inside Class

2004-09-10 Thread dirk
Well, doesn't work either: Parse error: parse error, unexpected T_VARIABLE, expecting T_FUNCTION in /srv/www/htdocs/stundenplan/stpoo.php on line 5 I forgot to mention that I'm using php-5.0.1 before Dirk On Fri, 10 Sep 2004 14:26:22 -0400, John Holmes [EMAIL PROTECTED] wrote: From: dirk

Re: [PHP] Array inside Class

2004-09-10 Thread John Holmes
From: dirk [EMAIL PROTECTED] Try this: var $input = array(1,2,3); var $input2 = array(); $this-input2 = array_pad($this-input,10,1); Well, doesn't work either: Parse error: parse error, unexpected T_VARIABLE, expecting T_FUNCTION in /srv/www/htdocs/stundenplan/stpoo.php on line 5 The array_pad

Re: [PHP] Array inside Class

2004-09-10 Thread dirk
Works fine within the constructor, thanks. Dirk On Fri, 10 Sep 2004 14:38:45 -0400, John Holmes [EMAIL PROTECTED] wrote: From: dirk [EMAIL PROTECTED] Try this: var $input = array(1,2,3); var $input2 = array(); $this-input2 = array_pad($this-input,10,1); Well, doesn't work either:

Re: [PHP] Array inside Class

2004-09-10 Thread Wouter van Vliet
On Fri, 10 Sep 2004 14:26:22 -0400, John Holmes [EMAIL PROTECTED] wrote: From: dirk [EMAIL PROTECTED] 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); } ?

Re: [PHP] Array inside Class

2004-09-10 Thread M. Sokolewicz
Wouter Van Vliet wrote: On Fri, 10 Sep 2004 14:26:22 -0400, John Holmes [EMAIL PROTECTED] wrote: From: dirk [EMAIL PROTECTED] 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);

Re: [PHP] Array inside Class

2004-09-10 Thread Greg Beaver
M. Sokolewicz wrote: To summarize: ?php class Liste { var $input2; var $input; function Liste() { /* or, if you're using php5: public function __construct() { */ $this-input = array(1,2,3); $this-input2 = array_pad($this-input,10,1); } } The reason being, for this, that