Re: Array Help Needed
- From: "J.O. Aho" <user@xxxxxxxxxxx>
- Date: Sun, 09 Nov 2008 18:58:12 +0100
Jerry wrote:
Hi,
I have an array of ORDER DETAILS (see below). I would like to pull out of
the order Object array all the [products] in the order that have the
[attributes] [option] equal to 'Subscription' (this example the order has 2
subscription products and 2 products that are not subscriptions, but other
orders may have more or less), and put them into a new array with the
following structure:
foreach($object->products as $product)
foreach($product[attributes] as $att)
if($att[option] == 'Subscription')
echo $product[name];
See http://www.php.net/foreach
You may want to make checks that you have arrays, as otherwise you may get a
not that nice surprise when an array hasn't been set.
--
//Aho
.
- Follow-Ups:
- Re: Array Help Needed
- From: Jerry
- Re: Array Help Needed
- References:
- Array Help Needed
- From: Jerry
- Array Help Needed
- Prev by Date: Array Help Needed
- Next by Date: Re: [GURU'S ONLY ;-)] Howto determine from which file an image is being requested?
- Previous by thread: Array Help Needed
- Next by thread: Re: Array Help Needed
- Index(es):
Relevant Pages
|