3v4l.org

run code in 300+ PHP versions simultaneously
<?php $users = [ ['email' => 'oldemail@email.com', 'state' => 'IL'], ['email' => 'diditwork@email.com', 'state' => 'HI'], ]; $jobs = [ ['title' => 'Marketing Coordinator', 'location' => 'Chicago', 'state' => 'IL'], ['title' => 'Sales Manager (MA)', 'location' => 'Springfield', 'state' => 'IL'], ['title' => 'Security Guard/Driver', 'location' => 'Big Island', 'state' => 'HI'], ['title' => 'Directory of Sales and Operation Planning', 'location' => 'Honolulu', 'state' => 'HI'], ]; foreach ($jobs as $job) { $jobs_by_state[$job['state']][] = $job; } foreach ($users as &$user) { $user['jobs'] = $jobs_by_state[$user['state']]; } echo json_encode($users, JSON_PRETTY_PRINT);
Output for git.master, git.master_jit, rfc.property-hooks
[ { "email": "oldemail@email.com", "state": "IL", "jobs": [ { "title": "Marketing Coordinator", "location": "Chicago", "state": "IL" }, { "title": "Sales Manager (MA)", "location": "Springfield", "state": "IL" } ] }, { "email": "diditwork@email.com", "state": "HI", "jobs": [ { "title": "Security Guard\/Driver", "location": "Big Island", "state": "HI" }, { "title": "Directory of Sales and Operation Planning", "location": "Honolulu", "state": "HI" } ] } ]

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:
62.54 ms | 403 KiB | 8 Q