3v4l.org

run code in 300+ PHP versions simultaneously
<?php $profiles = [ [ 'user_id' => 'fcc3d884-fbef-438a-9c86-0ad52c9b1223', 'first_name' => 'Narñia', 'middle_name' => 'Ñ', 'last_name' => 'Cruz', 'ext' => '' ], [ 'user_id' => '0d31557d-1e9f-4db3-ac0d-72e1709fe89c', 'first_name' => 'Randy', 'middle_name' => 'O', 'last_name' => 'Rocker', 'ext' => '' ], [ 'user_id' => '0f93f169-cf56-49df-a76b-7596446104c6', 'first_name' => 'Qwerty', 'middle_name' => 'K', 'last_name' => 'Asdfg', 'ext' => '' ], [ 'user_id' => '23b1f4a2-034c-43b4-96b7-3191d78cead1', 'first_name' => 'Johny', 'middle_name' => 'L', 'last_name' => 'Walker', 'ext' => '' ] ]; $encoded = [ [ 'encoder_id' => '0d31557d-1e9f-4db3-ac0d-72e1709fe89c', 'fullname' => 'Randy O. Rocker', 'encoded' => 10, ], [ 'encoder_id' => '23b1f4a2-034c-43b4-96b7-3191d78cead1', 'fullname' => 'John L. Walker', 'encoded' => 20, ] ]; $encodedByEncoderId = array_column($encoded, null, 'encoder_id'); $combined = array_reduce($profiles, static function (array $combined, array $profile) use ($encodedByEncoderId) : array { $combined[] = [ 'id' => $profile['user_id'], 'fullname' => "{$profile['first_name']} {$profile['middle_name']}. {$profile['last_name']}", 'encoded' => $encodedByEncoderId[$profile['user_id']]['encoded'] ?? 0 ]; return $combined; }, []); print_r($combined);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [id] => fcc3d884-fbef-438a-9c86-0ad52c9b1223 [fullname] => Narñia Ñ. Cruz [encoded] => 0 ) [1] => Array ( [id] => 0d31557d-1e9f-4db3-ac0d-72e1709fe89c [fullname] => Randy O. Rocker [encoded] => 10 ) [2] => Array ( [id] => 0f93f169-cf56-49df-a76b-7596446104c6 [fullname] => Qwerty K. Asdfg [encoded] => 0 ) [3] => Array ( [id] => 23b1f4a2-034c-43b4-96b7-3191d78cead1 [fullname] => Johny L. Walker [encoded] => 20 ) )

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:
27.24 ms | 407 KiB | 5 Q