3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 0 => ['userTag' => 'All', 'fbId' => 10210118553469338, 'price' => 70], 1 => ['userTag' => 'All', 'fbId' => 10210118553469338, 'price' => 14], 2 => ['userTag' => 'All', 'fbId' => 10210118553469338, 'price' => null], 3 => ['userTag' => 'Seeker', 'fbId' => 10207897577195936, 'price' => 65], 6 => ['userTag' => 'Seeker', 'fbId' => 709288842611719, 'price' => 75], 17 => ['userTag' => 'Trader', 'fbId' => 2145752308783752, 'price' => null] ]; $result = []; foreach ($array as $key => $row) { $result[$row['userTag'] === 'All' ? 'All' : $key] ??= $row; } var_export($result);
Output for git.master_jit, git.master, rfc.property-hooks
array ( 'All' => array ( 'userTag' => 'All', 'fbId' => 10210118553469338, 'price' => 70, ), 3 => array ( 'userTag' => 'Seeker', 'fbId' => 10207897577195936, 'price' => 65, ), 6 => array ( 'userTag' => 'Seeker', 'fbId' => 709288842611719, 'price' => 75, ), 17 => array ( 'userTag' => 'Trader', 'fbId' => 2145752308783752, 'price' => NULL, ), )

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:
80.1 ms | 406 KiB | 5 Q