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]
|