3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $info = array( array('catogary' => '麵包紙杯', 'typeA' => 'DPK219', 'typeB' => 'VAC001', 'price' => '1.00'), array('catogary' => '麵包紙杯', 'typeA' => 'DPK219', 'typeB' => 'VBW001', 'price' => '1.00'), array('catogary' => '罐裝蟹肉 ', 'typeA' => 'RCN061-1', 'typeB' => 'VAC001', 'price' => '2.00'), array('catogary' => '罐裝蟹肉 ', 'typeA' => 'RCN061-1', 'typeB' => 'VBW001', 'price' => '2.00'), array('catogary' => '牛淋片5mm', 'typeA' => 'RFB300-2', 'typeB' => 'VAC001', 'price' => '3.00'), array('catogary' => '牛淋片5mm', 'typeA' => 'RFB300-2', 'typeB' => 'VBW001', 'price' => '3.00'), array('catogary' => '厚牛淋片', 'typeA' => 'RFB300-3', 'typeB' => 'VAC001', 'price' => '4.00'), array('catogary' => '厚牛淋片', 'typeA' => 'RFB300-3', 'typeB' => 'VBW001', 'price' => '4.00'), ); $tableInfo = array(); $tableInfo = array_column($info, 'catogary', 'price');//if php version > 5.5 print_r($tableInfo); //foreach($info as $item) // $tableInfo[$item['catogary']] = $item['price']; ?> <table> <?php foreach($tableInfo as $catogary => $price) { ?> <tr> <td><?=$catogary?></td> <td><?=$price?></td> <td><?=$price?></td> </tr> </tbale> <?php }
Output for 5.5.24 - 7.1.0
Array ( [1.00] => 麵包紙杯 [2.00] => 罐裝蟹肉 [3.00] => 牛淋片5mm [4.00] => 厚牛淋片 ) <table> <tr> <td>1.00</td> <td>麵包紙杯</td> <td>麵包紙杯</td> </tr> </tbale> <tr> <td>2.00</td> <td>罐裝蟹肉 </td> <td>罐裝蟹肉 </td> </tr> </tbale> <tr> <td>3.00</td> <td>牛淋片5mm</td> <td>牛淋片5mm</td> </tr> </tbale> <tr> <td>4.00</td> <td>厚牛淋片</td> <td>厚牛淋片</td> </tr> </tbale>
Output for 5.0.0 - 5.4.45
Fatal error: Call to undefined function array_column() in /in/WJYiU on line 15
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: array_column() in /in/WJYiU on line 15
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: array_column() in /in/WJYiU on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: array_column() in /in/WJYiU on line 15