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
*/


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

Reply via email to