You are here: Re: Recurse an array with an object/s « PHP Programming Language « IT news, forums, messages
Re: Recurse an array with an object/s

Posted by Aggelos on 02/07/07 16:54

> But one question - you say you have a two dimensional array. But this
> is only a single dimensional array. It just happens that an array
> element might itself be an array. That's not two dimensions.

ok I'll explain to you and tell me if I am wrong.

I have class package and class product

A package has many products when I call my constructor for the package
I create an array of it's products as well.

CODE:

class package {
var $packageId;
var $title;
var $description;

var $_productArray = array();

function package($packageId=NULL,$title=NULL,$description=NULL) {
$this->packageId = $packageId;
$this->title = $title;
$this->description = $description;

$productPackageArray = product_package::select(array('package_id'=>
$packageId));
foreach($productPackageArray[$packageId] as $contentId =>
$publishedArray) {
foreach($publishedArray as $published => $productValue) {
$_ObjProduct = product::select(array('content_id'=>
$contentId,'published'=>$published));
$this->_productArray[$_product[$contentId][$published]-
>productTypeId] = $_ObjProduct;
}
}
}
.......
}

END OF CODE

I am not sure if you'll understand my code but anyway I end up
creating product packages and having an object package which instead
of having just the ids of the products has the whole object in it.

and that creates an array like that $package[$packageId]-
>_productArray[$productTypeId] = $_ObjProduct; (I don't know how to
symbolize the object inside the array)

So how many dimensions is that and how does it look to you Jerry. ?

 

Navigation:

[Reply to this 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

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