3v4l.org

run code in 500+ PHP versions simultaneously
<?php $user = [ 'profile' => [ 'authkey' => '', 'publickey' => '', 'status' => 19 ], 'setup' => [ 'profile' => false, 'contact' => false, 'payments' => false, 'subscription' => false ], 'paygateway' => [ 'paypal' => [ 'publickey' =>'', 'secretkey' => '', 'testarray' => [ 'key1' => 'value1', 'key2' => 'value2', 'key3' => [ 'key4' => 'level4' ] ], 'webhookid' => '' ], 'stripe' => [ 'publickey' => '', 'secretkey' => '' ] ] ]; function buildKeyPath(array $array, string $path): array { $result = []; foreach ($array as $key => $value) { if (is_array($value)) { $result = array_merge($result, buildKeyPath($value, "{$path}[$key]")); } else { $result[] = "{$path}[$key]"; } } return $result; } foreach ($user as $k => &$v) { $v = buildKeyPath($v, "[$k]"); } var_export($user);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'profile' => array ( 0 => '[profile][authkey]', 1 => '[profile][publickey]', 2 => '[profile][status]', ), 'setup' => array ( 0 => '[setup][profile]', 1 => '[setup][contact]', 2 => '[setup][payments]', 3 => '[setup][subscription]', ), 'paygateway' => array ( 0 => '[paygateway][paypal][publickey]', 1 => '[paygateway][paypal][secretkey]', 2 => '[paygateway][paypal][testarray][key1]', 3 => '[paygateway][paypal][testarray][key2]', 4 => '[paygateway][paypal][testarray][key3][key4]', 5 => '[paygateway][paypal][webhookid]', 6 => '[paygateway][stripe][publickey]', 7 => '[paygateway][stripe][secretkey]', ), )

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:
44.04 ms | 1365 KiB | 4 Q