0
我基本上需要找到一種方法來查看哪些產品的排序最多,然後返回前5個'post_id'的數組。複雜的PHP數組邏輯
這是一個包含產品細節不同階的數組:
Array
(
[1] => Array
(
[post_id] => 1
[post_ident] => macbook_pro
[post_name] => Macbook Pro
[post_parent_ident] => rings
[post_cat_ident] => default
[post_module_ident] => store
[post_price] => 999.00
[post_currency] => EUR
[item_link] => index.php?module=store&show=post&category=default&parent=rings&post=macbook_pro
[qty] => 1
)
)
Array
(
[1] => Array
(
[post_id] => 1
[post_ident] => macbook_pro
[post_name] => Macbook Pro
[post_parent_ident] => rings
[post_cat_ident] => default
[post_module_ident] => store
[post_price] => 999.00
[post_currency] => EUR
[item_link] => index.php?module=store&show=post&category=default&parent=rings&post=macbook_pro
[qty] => 1
)
)
Array
(
[1] => Array
(
[post_id] => 1
[post_ident] => macbook_pro
[post_name] => Macbook Pro
[post_parent_ident] => rings
[post_cat_ident] => default
[post_module_ident] => store
[post_price] => 999.00
[post_currency] => EUR
[item_link] => index.php?module=store&show=post&category=default&parent=rings&post=macbook_pro
[qty] => 1
)
)
如何確定哪些產品陣列中最?
例如,post_id 1的產品在數組中的3次。我如何計算,然後返回數組中的第一個項目的post_id?
該數組來自SQL嗎? – thirtydot 2011-04-06 17:09:47
不,產品詳細信息是序列化的,這是反序列化後的輸出。 – tmartin314 2011-04-06 17:11:34