RE: php array question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





>-----Original Message-----
>From: Victor C. [mailto:cao117@xxxxxxxxxxx] 
>Sent: Tuesday, November 02, 2004 3:06 AM
>To: php-general@xxxxxxxxxxxxx
>Subject:  php array question
>
>
>Hi,
>I have a line of php that I don't really understand.
>
>foreach($this->orders as $OrderID => $value) {
>    echo $OrderID."<BR>";
I think Problem is with this line (I am surprised to see it does not
throw a parsing error. As it should !)
>    $OrderObject =$this->orders[$OrderID=>$value];

If $this->orders is an array of order objects then
Following line should be  sufficient 
$OrderObject =$this->orders[$OrderID];
  Or
$OrderObject =$value;

Zareef ahmed
>    echo $OrderObject->OrderID."<--all the same<BR>";
>}
>
>I know that $this->orders is an array of "order" objects.
>
>the result i get from this is:
>
>line1. 388<--OrderID.
>line2. 389<--all the same
>line3. 389<--OrderID.
>line4. 389<--all the same
>
>I'm really confused about why line 1 and line 3 have different OrderID,
but line 2 and 4 have the same... I've been trying >to fix this bug for
3 hrs with no luck. Any help would be really appreciated..

>Thanks a lot

------------------------------------------------------------------------
--
Zareef Ahmed :: A PHP develoepr in Delhi ( India )
Homepage :: http://www.zasaifi.com

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux