Hi m.stenzel!
On Tue, 24 Jul 2001, [EMAIL PROTECTED] wrote:

> From:             [EMAIL PROTECTED]
> Operating system: W2K
> PHP version:      4.0.6
> PHP Bug Type:     Class/Object related
> Bug description:  Referencing multiple arrays in classes from inside methods doesn't 
>work
> 
> Configuration: IIS 4 dll with Win32 binaries
> 
> Okay I'm new to the game so forgive me a small mistake but I have tested
> and reproduced this weird behavior for more than 6 hours.
> 
> A class wrapping multiple array variables doesn't allow to access both
> arrays as individual references from inside a function.
> 
> The following code does not what I expected from the language:
> 
> class test {
>   VAR $firstarray;  // defining one array
>   VAR $secondarray; // defining another array
>       
>   function testit () {
>     $i = 0;
>     while ($i < 14) {
>       $this->$firstarray[$i] = uniqid ("test", false);
>         $this->$secondarray[$i] = uniqid ("different", false);
that should be $this->firstarray and $this->secondarray.
the manual (www.php.net/manual/ I guess) is quite clear about it.

>       echo "Set array #1, item $i to ".$this->$firstarray[$i]." and array
> 
> I think i read the manual thorougly and haven't found a hint about this
> behavior :(
> 
Chapter 13. Classes and Objects
class Cart {
var $items; 
 ...

 function remove_item ($artnr, $num) {
         if ($this->items[$artnr] > $num) {
             $this->items[$artnr] -= $num;
                    ^... no $ here



-- teodor

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to