Reply to Re: Retrieving an object from an array

Your name:

Reply:


Posted by David Haynes on 06/09/06 18:08

Ramon wrote:
> class ProductList {
> var $m_oProductList = array();
>
> function add ($oProduct) {
> $this->m_oProductList[] =& $oProduct;
$this->m_oProductList[$oProduct->getID()] =& $oProduct;
// don't know if you need =& here, = may be enough
> }
>
> function getProductByID ($iID) {
> return $this->m_oProductList[ ??? ]; <-- and this is where I got
> stuck...
return $this->m_oProductList[$iID];
> }
> }

should work. [Caveat: it's Friday... ;-) ]

-david-

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация