<?php $a = ['A[1]', 'B[2]', 'C[2]', 'D[2]']; $b = ['B[3]', 'C[4]', 'E[4]', 'F[2]', 'G[2]']; var_export( array_values( array_reduce( array_merge($a, $b), function($result, $v) { $result[strtok($v, '[')] = $v; return $result; } ) ) );
You have javascript disabled. You will not be able to edit any code.