3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( 0 => array ( 'company_id' => 1, 'company_abbrev' => 'amd', 'description' => 'amd blah blah blah 1', ), 1 => array ( 'company_id' => 1, 'company_abbrev' => 'amd', 'description' => 'amd blah blah blah 2', ), 2 => array ( 'company_id' => 2, 'company_abbrev' => 'int', 'description' => 'int blah blah 1', ), 3 => array ( 'company_id' => 2, 'company_abbrev' => 'int', 'description' => 'int blah blah 2', ), ); $result = []; foreach ($array as $row) { extract($row); $result[$company_abbrev]['company_id'] = $company_id; $result[$company_abbrev]['job_descriptions'][] = $description; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'amd' => array ( 'company_id' => 1, 'job_descriptions' => array ( 0 => 'amd blah blah blah 1', 1 => 'amd blah blah blah 2', ), ), 'int' => array ( 'company_id' => 2, 'job_descriptions' => array ( 0 => 'int blah blah 1', 1 => 'int blah blah 2', ), ), )

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