3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = Array( '0' => Array ( 'code' => 'Custom discount', 'amount' => 3514.55, 'type' => 'fixed_amount' ), '1' => Array ( 'code' => 'MerOrder300', 'amount' => 400.00, 'type' => 'fixed_amount' ), '2' => Array ( 'code' => 'MerOrder400', 'amount' => 400.00, 'type' => 'fixed_amount' ), '3' => Array ( 'code' => 'MerOrder450', 'amount' => 450.00, 'type' => 'fixed_amount' ) ); $amountArr = array_column($arr, null, 'amount'); print_r($amountArr[max(array_keys($amountArr))]);
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Deprecated: Implicit conversion from float 3514.55 to int loses precision in /in/d2WRf on line 32 Array ( [code] => Custom discount [amount] => 3514.55 [type] => fixed_amount )
Output for 7.2.9 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
Array ( [code] => Custom discount [amount] => 3514.55 [type] => fixed_amount )
Output for 7.2.0 - 7.2.8
Array ( [code] => MerOrder450 [amount] => 450 [type] => fixed_amount )

preferences:
108.94 ms | 1514 KiB | 4 Q