3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ [ "id" => '6230061c0e88d709ca0d7bbc', 'name' => 'Mobile SamSung', 'slug' => 'mobile-samsung', 'createdAt' => '1648006346' ], [ "id" => '5d1eff529a426778d4b92383', 'name' => 'Mobile Iphone', 'slug' => 'mobile-iphone', 'createdAt' => '1647314181' ], [ "id" => '5d1eff6b9a426778d4b92dc4', 'name' => 'Mobile SamSung', 'slug' => 'mobile-samsung', 'createdAt' => '1647314460' ], [ "id" => '5f894011266aea580b028cb0', 'name' => 'Mobile LG', 'slug' => 'mobile-lg', 'createdAt' => '1647314456' ] ]; $result = []; foreach ($arr as $row) { if (!isset($result[$row['name']]) || (int)$row['createdAt'] > (int)$result[$row['name']]['createdAt']) { $result[$row['name']] = $row; } } var_export(array_values($result));
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'id' => '6230061c0e88d709ca0d7bbc', 'name' => 'Mobile SamSung', 'slug' => 'mobile-samsung', 'createdAt' => '1648006346', ), 1 => array ( 'id' => '5d1eff529a426778d4b92383', 'name' => 'Mobile Iphone', 'slug' => 'mobile-iphone', 'createdAt' => '1647314181', ), 2 => array ( 'id' => '5f894011266aea580b028cb0', 'name' => 'Mobile LG', 'slug' => 'mobile-lg', 'createdAt' => '1647314456', ), )

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:
51.71 ms | 402 KiB | 8 Q