[英]Create associative multi-dimensional array
我有3個變量,每個變量持有不同的信息,並動態地從文本文件發送值。 我想將它們放在關聯的多維數組中。
比方說:
$product sends car, truck, train, etc.
$price sends 1000, 3000, 1500, etc.
$year sends 1997, 1980, 2008, etc.
當我執行print_r(myarray)時,如何創建如下生成數組的函數:
Array (
[0] => Array ( [product] => car [price] => 1000 [year] => 1997 )
[1] => Array ( [product] => truck [price] => 3000 [year] => 1980 )
[2] => Array ( [product] => train [price] => 1500 [year] => 2008 )) and so on.
看一下這個問題: 用php中的循環定義2D數組
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.