3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ [10, 'Some Name..'], [11, 'Some Name..'], [13, 'Some Name..'], ]; $array2 = [ [13, 'Viewed'] ]; $result = []; foreach (array_merge($array1, $array2) as [$id, $value]) { $result[$id][0] = $id; $result[$id][] = $value; } var_export($result);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
161.86 ms | 1753 KiB | 10 Q