3v4l.org

run code in 300+ PHP versions simultaneously
<?php $links = [ [ 'type_id' => '1', 'url' => '' ], [ 'type_id' => '2', 'url' => '' ] ]; $types = [ [ 'value' => 'facebook' ], [ 'value' => 'twitter' ] ]; $result = []; for($i = 0, $len = count($types); $i < $len; $i++) { $result[$types[$i]['value']] = $links[$i]; } $data = [ 'primary' => [ 'address_details' => [], 'contact_details' => [], 'social_links' => $result ] ]; var_dump($data);
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { ["primary"]=> array(3) { ["address_details"]=> array(0) { } ["contact_details"]=> array(0) { } ["social_links"]=> array(2) { ["facebook"]=> array(2) { ["type_id"]=> string(1) "1" ["url"]=> string(0) "" } ["twitter"]=> array(2) { ["type_id"]=> string(1) "2" ["url"]=> string(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:
173.11 ms | 406 KiB | 5 Q