3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = Array ( 0 => Array ( 'entry_id' => 1, 'ic' => 2147483647, 'name' => 'Kořínková Blanka', 'residency' => 'Štětí, Lukešova 354, 411 08', 'file_no' => 'KSUL 77 INS 18898 / 2013', 'detail' => '749371da-725c-4738-8def-2f7167142a6f' ), 1 => Array ( 'entry_id' => 1, 'ic' => 2147483647, 'name' => 'Kořínková Blanka', 'residency' => 'Štětí, Lukešova 354, 411 08', 'file_no' => 'KSUL 77 INS 21218 / 2013', 'detail' => '43b6a718-4647-451d-9c53-50dfee8403ff' ), 2 => Array ( 'entry_id' => 2, 'ic' => 46900217, 'name' => 'ENTEC a.s. "v likvidaci"', 'residency' => 'Staré Město, Brněnská 1916, 686 03', 'file_no' => 'KSBR 28 INS 1232 / 2013', 'detail' => 'e2155a52-c464-4357-b71b-4f4ff75585eb' ) ); $mergeId = 'entry_id'; $data = array_reduce($data, function($c, $x) use ($mergeId) { $c[$x[$mergeId]] = isset($c[$x[$mergeId]]) ?array_combine( $z=array_keys($c[$x[$mergeId]]), array_map(function($y) use ($x, $c, $mergeId) { return in_array($x[$y], (array)$c[$x[$mergeId]][$y]) ?$c[$x[$mergeId]][$y] :array_merge((array)$c[$x[$mergeId]][$y], [$x[$y]]); }, $z) ) :$x; return $c; }, []); var_dump($data);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [1]=> array(6) { ["entry_id"]=> int(1) ["ic"]=> int(2147483647) ["name"]=> string(19) "Kořínková Blanka" ["residency"]=> string(31) "Štětí, Lukešova 354, 411 08" ["file_no"]=> array(2) { [0]=> string(24) "KSUL 77 INS 18898 / 2013" [1]=> string(24) "KSUL 77 INS 21218 / 2013" } ["detail"]=> array(2) { [0]=> string(36) "749371da-725c-4738-8def-2f7167142a6f" [1]=> string(36) "43b6a718-4647-451d-9c53-50dfee8403ff" } } [2]=> array(6) { ["entry_id"]=> int(2) ["ic"]=> int(46900217) ["name"]=> string(24) "ENTEC a.s. "v likvidaci"" ["residency"]=> string(38) "Staré Město, Brněnská 1916, 686 03" ["file_no"]=> string(23) "KSBR 28 INS 1232 / 2013" ["detail"]=> string(36) "e2155a52-c464-4357-b71b-4f4ff75585eb" } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
39.36 ms | 403 KiB | 8 Q