Re: php array question

From: Date: Mon, 01 Nov 2004 21:52:35 +0000
Subject: Re: php array question
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-200871@lists.php.net to get a copy of this message
Ben Ramsey wrote:
Victor C. wrote:
    $OrderObject =$this->orders[$OrderID=>$value];
This line is confusing. $OrderID=>$value is either a typo or is just plain wrong. It looks like what it's meant to say is: $OrderObject = $this->orders[$OrderID]; But this will just set $OrderObject equal to $value, so you should just use: $OrderObject = $value; Try that and see if it works.
Nevermind. I read that wrong. $this->orders is an array of objects, like you said, which I glanced over too quickly. My statement above still holds, though. $this->orders[$OrderID=>$value] still appears to be a typo to me. It might supposed to be: $OrderObject = $this->orders[$OrderID] which will return the order object at $OrderID location in the array ($OrderID being the array key). Then, $OrderObject->OrderID should work properly. However, I would think that echo $OrderObject->OrderID; should produce the same results as echo $OrderID; But I could be wrong since I'm not exactly sure how the order object looks. Perhaps doing a var_dump on the $this->orders would help us out? -- Ben Ramsey Zend Certified Engineer http://benramsey.com --------------------------------------------------- Atlanta PHP - http://www.atlphp.org/ The Southeast's premier PHP community. ---------------------------------------------------

« previous php.general (#200871) next »