You are here: Merging Duplicate array items « PHP « IT news, forums, messages
Merging Duplicate array items

Posted by Joe Harman on 06/18/05 21:25

Hello, I've been trying to figure out on how I could evaluated this
array and combine like items... here is the array.. it represents a
shopping cart contents.. you'll notice that the first array is the
same as the third... what I am trying to do is combine the quantity of
the first array and the third... I am not asking from someone to
program this for me... just for someone to give me a heads up on if
there is a array function I could use. Thanks for any help!

------------- array example --------------------

$ARY_cart[] = array( 'product_id' => '123',
'sku' => 'DFBag-12',
'quantity' => '2',
'product_name' => 'Dog Food',
'unit' => '12 lbs. Bag',
'price' => '12.05'
);
$ARY_cart[] = array( 'product_id' => '224',
'sku' => 'cFBag-6',
'quantity' => '1',
'product_name' => 'Cat Food',
'unit' => '8 lbs. Bag',
'price' => '4.25'
);
$ARY_cart[] = array( 'product_id' => '123',
'sku' => 'DFBag-12',
'quantity' => '24',
'product_name' => 'Dog Food',
'unit' => '12 lbs. Bag',
'price' => '12.05'
);


--
Joe Harman
---------
Do not go where the path may lead, go instead where there is no path
and leave a trail. - Ralph Waldo Emerson

 

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

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