我的一些代碼需要幫助。我需要使用其中的數(shù)字prijs進行計算。$autos = array( "<b>Mercedes</b>" =>array( "Kenteken" => "77NLXJ", "Prijs" => "54800",), "<b>Tesla</b>" =>array( "Kenteken" => "GV713G", "Prijs" => "70700",), "<b>Porsche</b>" =>array( "Kenteken" => "GG101K", "Prijs" => "85000",)這可能嗎? $keys = array_keys($autos); for($i = 0; $i < count($autos); $i++) { echo $keys[$i] . "<br>"; foreach($autos[$keys[$i]] as $key => $value) { echo $key . " : " . $value . "<br>"; } echo "<br>"; }
1 回答

湖上湖
TA貢獻2003條經(jīng)驗 獲得超2個贊
要訪問和更改它們,您需要通過$autos數(shù)組訪問它們:
//by loop:
foreach($autos as $key => $auto){
//get or set them with this var
$autos[$key]["Prijs"];
}
//to get and set them directly:
$autos[0]["Prijs"];
$autos[1]["Prijs"];
$autos[2]["Prijs"];
- 1 回答
- 0 關(guān)注
- 126 瀏覽
添加回答
舉報
0/150
提交
取消