<?php
$array = [
['attribute' => 1.5, 'value' => 'one & a half'],
['attribute' => 2, 'value' => 'two'],
['attribute' => 1, 'value' => 'one'],
];
var_export(
array_column($array, 'value', 'attribute')
);
- Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
- Deprecated: Implicit conversion from float 1.5 to int loses precision in /in/KpC9Q on line 10
array (
1 => 'one',
2 => 'two',
)
- Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30
- array (
1 => 'one',
2 => 'two',
)
preferences:
109.36 ms | 407 KiB | 5 Q