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); foreach($rows as $row) { $temp = []; for ($i = 0; $i < strlen($row); $i++) { if ($row[$i] === "\"") $quoted = !$quoted; if ($row[$i] === " " && !$quoted) { $index++; continue; } $temp[$index] = ($temp[$index] ?? "") . $row[$i]; } $data[] = array_values($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(3) { [0]=> string(10) "#GENERATED" [1]=> string(7) "2020715" [2]=> 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:
36.98 ms | 406 KiB | 5 Q