如何转换此数组格式:
Array ( [0] => Array ( [quantity] => 200.00000000 )
[1] => Array ( [quantity] => 200.00000000 ) [2] => Array ( [quantity] => 200.00000000 )
[3] => Array ( [quantity] => 200.00000000 ) [4] => Array ( [quantity] => 200.00000000 )
[5] => Array ( [quantity] => 200.00000000 ) [6] => Array ( [quantity] => 200.00000000 )
[7] => Array ( [quantity] => 200.00000000 ) )
到这种形式:
Array ( [0] => 200 [1] => 200 [2] => 200 [3] => 200 [4] => 200 [6] => 200 [7] => 200 )
PHP中的。提前谢谢。
答案 0 :(得分:0)
此功能可以帮助您
function convert($array)
{
$result = [];
foreach ($array as $key => $value)
$result[] = $value['quantity'];
return $result;
}
$array = convert($array);