Re: array's

From: Date: Sun, 18 Aug 2002 16:09:54 +0000
Subject: Re: array's
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-113140@lists.php.net to get a copy of this message
now it works, thx alot :) regards patrick "Jason Wong" <php-general@gremlins.com.hk> skrev i meddelandet news:200208181252.07715.php-general@gremlins.com.hk... > On Sunday 18 August 2002 12:25, Pafo wrote: > > anyone that can find the problem..? > > description below. > > > > > function PrintInfo() { > > for ($this->i = 0; $this->i < count($this->RelicName); $this->i++) { > > print "$this->RelicName[$this->i] : $this->RelicType[$this->i] : > > $this->RelicRealm[$this->i] : $this->RelicOwner[$this->i]<br>"; > > } > > } > > Not sure why you're defining your counter as $this->i. I would just use $i. > Your problem is that inside double quotes the expression: > > $this->RelicName[$this->i] > > is ambiguous. In this case what the interpreter has done is to print > $this->RelicName, which is an array, so your output contains 'Array'. It then > prints a literal bracket '[', then the value of $this-i, then another literal > bracket ']', and thus that is what you see. > > To remove the ambiguity to need to state exactly what you mean and enclose > your expression in {} : > > print "{$this->RelicName[$this->i]} ..." > > > > the function PrintInfo prints out this: > > '***************************************' OUTPUT > > '**************************************' > > > > Array[0] : Array[0] : Array[0] : Array[0] > > Array[1] : Array[1] : Array[1] : Array[1] > > Array[2] : Array[2] : Array[2] : Array[2] > > > > heh,, not exacly what i wanted :/ > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Argue for your limitations, and sure enough, they're yours. > -- Messiah's Handbook : Reminders for the Advanced Soul > */ >

« previous php.general (#113140) next »