codeigniter 如何在PHP中创建一个数组?

ccgok5k5  于 2022-12-07  发布在  PHP
关注(0)|答案(1)|浏览(135)

此问题在此处已有答案

Loop through a two-dimensional array(6个答案)
关闭5个月前.

Array
(
    [0] => Array
        (
            [matter] => 1.00
            [max_matter] => 76.27
            [batter] => 76961
            [bat] => AVR3333
            [brand] => TATA
            [price] => 423.73
            [batterfee] => 500.00
            [batterid] => 156311038
            [batterscore] => 18.00
        )
      [1] => Array
            (
                [matter] => 1.00
                [max_matter] => 76.27
                [batter] => 76961
                [bat] => AVR3333
                [brand] => TATA
                [price] => 423.73
                [batterfee] => 500.00
                [batterid] => 156311038
                [batterscore] => 18.00
        )

)
5sxhfpxr

5sxhfpxr1#

$arr[0] = array('matter' => 1.00,'max_matter' => '76.27', 'batter' => '76961','bat' => 'AVR3333','brand' => 'TATA','price' => '423.73', 'batterfee' => '500.00', 'batterid => '156311038', 'batterscore => '18.00');
$arr[1] = array('matter' => 1.00,'max_matter' => '76.27', 'batter' => '76961','bat' => 'AVR3333','brand' => 'TATA','price' => '423.73', 'batterfee' => '500.00', 'batterid => '156311038', 'batterscore => '18.00');

foreach ($arr as $i=>$a) {
   foreach ($a as $k=>$v) {
      echo "Array Index is ".$i.": Key is ".$k." and value is ".$v."\n";
   }
}

相关问题