配列の中のキーを配列として格納することが可能。
meet.php
$meet=array('鶏肉'=>array('price'=>68,'stock'=>10),'豚肉'=>array('price'=>89,'stock'=>15),'牛肉'=>array('price'=>128,'stock'=>8));foreach($meetas$name=>$value){echo$name.'は、100グラム'.$value['price'].'円、在庫は'.$value['stock'].'個です。'.'<br>';}
↓実行結果
meet.php
鶏肉は、100グラム68円、在庫は10個です。豚肉は、100グラム89円、在庫は15個です。牛肉は、100グラム128円、在庫は8個です。
複雑な構造を持つデータの配列として定義することが出来ます。