3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '1,Home,3,Services,6,Service 1,7,Service 2,2,Products'; $keysAndValues = explode(',', $input); $result = []; $count = count($keysAndValues); for ($i = 0; $i < $count; $i+=2) { $key = $keysAndValues[$i]; $value = $keysAndValues[$i+1]; $result[$key] = $value; } var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
array(5) { [1]=> string(4) "Home" [3]=> string(8) "Services" [6]=> string(9) "Service 1" [7]=> string(9) "Service 2" [2]=> string(8) "Products" }

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:
27.47 ms | 405 KiB | 5 Q