3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 0 => [ "user_type" => 'Trainee', "total_count" => 3, ] ]; $array_column = array_column($array, 'total_count', 'user_type'); //Create new array like below $add_array = array('Manager'=>'0', 'Director'=>'0', 'Trainee'=>'0',); //using array_merge merge add_array and array_column $new_array = array_merge($add_array, $array_column); //using array_walk_recursive get the requird result array_walk_recursive($new_array, function($item, $key) use (&$final_array){ $final_array['labels'][]=$key; $final_array['dataset'][]=$item; }); echo "<pre>"; print_r($final_array); ?>
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [labels] => Array ( [0] => Manager [1] => Director [2] => Trainee ) [dataset] => Array ( [0] => 0 [1] => 0 [2] => 3 ) )

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