3v4l.org

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

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.35 ms | 408 KiB | 5 Q