配列をエコーすると、結果は次のようになります。
$Items = Array( [147] => Array([ItemName] => Array([0]=>White Snack [1]=>Dark Cookie) [ItemCode] => Array([0]=>IT-WS [1]=>IT-DC ) ) [256] => Array([ItemName] => Array([0]=>Soft Sandwiches [1]=>Hard Drinks) [ItemCode] => Array([0]=>IT-SS [1]=>IT-HD ) ))
ここで、次の結果、インデックス 147 および 256 を表形式で表示する必要があります。正しいインデックス値を取得するために、別の foreach ループからそれらを渡します。
-----------147---------------
名前 ----------------------------------- コード
ホワイトスナック --------------------------- WS
ダーククッキー --------------------------- DC
-----------256---------------
名前 ----------------------------------- コード
ソフトサンド ---------------------- SS
ハードドリンク -------------------------------- HD
これを達成することはできません。助けてください。
$ItemIndexes = array(147,256);
foreach($ItemIndexes as $ItemMainIndex)
{
//further code here ,
//here I would send the $ItemMainIndex to the $Items array
//and get the corresponding index value and display it accordingly.
}