3v4l.org

run code in 300+ PHP versions simultaneously
<?php $your_data = "5:7|4:1|504:2|1:3|"; $data = array(); foreach (explode("|", $your_data) as $part) { $pieces = explode(':', $part); // Assumes we have 2 pieces, might want to make sure here... $data[$pieces[0]] = $pieces[1]; } var_export($data);
Output for git.master_jit, git.master
Warning: Undefined array key 1 in /in/oq3Rb on line 11 array ( 5 => '7', 4 => '1', 504 => '2', 1 => '3', '' => NULL, )

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