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
いいえ、製品の詳細はシリアル化されており、これはシリアル化解除後の出力です。 – tmartin314