3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = '|> Томмот|Якутия| |> Удачный|Якутия| |> Якутск|Якутия| |> Губкинский|Ямало-Ненецкий авт. окр.|'; $lines = explode("\n", $data); $items = array_map(function($line) { $cells = explode('|', substr($line, 3)); return ['city' => $cells[0], 'area' => $cells[1]]; }, $lines); var_dump($items);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> array(2) { ["city"]=> string(12) "Томмот" ["area"]=> string(12) "Якутия" } [1]=> array(2) { ["city"]=> string(14) "Удачный" ["area"]=> string(12) "Якутия" } [2]=> array(2) { ["city"]=> string(12) "Якутск" ["area"]=> string(12) "Якутия" } [3]=> array(2) { ["city"]=> string(20) "Губкинский" ["area"]=> string(43) "Ямало-Ненецкий авт. окр." } }

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:
30.41 ms | 407 KiB | 5 Q