3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr =[ [ "websites" => "base", "simples_skus" => "", "sku" => "8681455000016", "code" => "10001", ], [ "websites" => "base", "simples_skus" => "", "sku" => "8681455000023", "code" => "10001", ], [ "websites" => "base", "simples_skus" => "", "sku" => "8681455000214", "code" => "20003", ], [ "websites" => "base", "simples_skus" => "", "sku" => "8681455000221", "code" => "20003", ], [ "websites" => "base", "simples_skus" => "", "sku" => "8681455000245", "code" => "23443", ] ]; function merge($carry, $item){ var_dump($carry); echo "\n"; var_dump($item); echo "\n\n"; $carry=$item; return $carry; } $result = array_reduce(array_values($arr), "merge"); //var_dump($result);
based on PG0rC
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
NULL array(4) { ["websites"]=> string(4) "base" ["simples_skus"]=> string(0) "" ["sku"]=> string(13) "8681455000016" ["code"]=> string(5) "10001" } array(4) { ["websites"]=> string(4) "base" ["simples_skus"]=> string(0) "" ["sku"]=> string(13) "8681455000016" ["code"]=> string(5) "10001" } array(4) { ["websites"]=> string(4) "base" ["simples_skus"]=> string(0) "" ["sku"]=> string(13) "8681455000023" ["code"]=> string(5) "10001" } array(4) { ["websites"]=> string(4) "base" ["simples_skus"]=> string(0) "" ["sku"]=> string(13) "8681455000023" ["code"]=> string(5) "10001" } array(4) { ["websites"]=> string(4) "base" ["simples_skus"]=> string(0) "" ["sku"]=> string(13) "8681455000214" ["code"]=> string(5) "20003" } array(4) { ["websites"]=> string(4) "base" ["simples_skus"]=> string(0) "" ["sku"]=> string(13) "8681455000214" ["code"]=> string(5) "20003" } array(4) { ["websites"]=> string(4) "base" ["simples_skus"]=> string(0) "" ["sku"]=> string(13) "8681455000221" ["code"]=> string(5) "20003" } array(4) { ["websites"]=> string(4) "base" ["simples_skus"]=> string(0) "" ["sku"]=> string(13) "8681455000221" ["code"]=> string(5) "20003" } array(4) { ["websites"]=> string(4) "base" ["simples_skus"]=> string(0) "" ["sku"]=> string(13) "8681455000245" ["code"]=> string(5) "23443" }