3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['user_id' => 82, 'ac_type' => 1], ['user_id' => 80, 'ac_type' => 5], ['user_id' => 76, 'ac_type' => 1], ['user_id' => 82, 'ac_type' => 2], ['user_id' => 80, 'ac_type' => 5] ]; foreach ($array as $a) { $result[$a['user_id']] ??= $a; // only store if first occurrence of user_id } var_export(array_values($result)); // re-index and print

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
209.4 ms | 1903 KiB | 10 Q