3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'email' => [ "william.pool@gmail.com", "martynleeball@gmail.com" ], 'lastName' => [ 'Pool', 'Ball' ], 'firstName' => [ 'William', 'Martyn' ], 'id' => [ 'j8zwyk', '1' ] ]; $newArr = []; foreach($arr as $key=>$item){ foreach($item as $key2=>$item2) $newArr[$key2][$key] = $item2; } var_dump($newArr);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(4) { ["email"]=> string(22) "william.pool@gmail.com" ["lastName"]=> string(4) "Pool" ["firstName"]=> string(7) "William" ["id"]=> string(6) "j8zwyk" } [1]=> array(4) { ["email"]=> string(23) "martynleeball@gmail.com" ["lastName"]=> string(4) "Ball" ["firstName"]=> string(6) "Martyn" ["id"]=> string(1) "1" } }

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