3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '#PROGRAM "Accounting company" 98.2 #GENERATED 2020715 "SE"'; $quoted = false; $index = 0; $data = []; $rows = explode("\n", $str); $isPreviousSpace = false; foreach ($rows as $row) { $temp = []; $index = 0; $isPreviousSpace = false; for ($i = 0; $i < strlen($row); $i++) { if ($row[$i] === "\"") $quoted = !$quoted; if ($row[$i] === " " && !$quoted) { if (!$isPreviousSpace) { $temp[$index] = $temp[$index] ?? ""; $index++; } $isPreviousSpace = true; continue; } $isPreviousSpace = false; $temp[$index] = ($temp[$index] ?? "") . $row[$i]; } $data[] = $temp; } var_dump($data);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(3) { [0]=> string(8) "#PROGRAM" [1]=> string(20) ""Accounting company"" [2]=> string(4) "98.2" } [1]=> array(4) { [0]=> string(0) "" [1]=> string(10) "#GENERATED" [2]=> string(7) "2020715" [3]=> string(4) ""SE"" } }

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:
150.18 ms | 406 KiB | 5 Q