3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "19018216307,Public,\,k]'=system1-system2,20230914143505.5,1-050000,No"; $pattern = <<<'REGEX' ~(?nxx) (?# modifiers: - inline n: parenthesis act as non-capturing groups - inline xx: spaces are ignored even in character classes - global A: all the matches have to be contiguous ) # pattern ( (?!\A) , \K | \A ) # not at the start with a commas or at the start without [^ , \\ ]* ( \\ . [^ , \\ ]* )* # field content (all that isn't a comma nor # a backslash, or an escaped character) # check ( \z (*:END) )? # define a marker if the end of the string is reached ~A REGEX; if (preg_match_all($pattern, $str, $m) && isset($m['MARK'])) { $result = array_map(fn($s) => strtr($s, ['\\\\' => '\\', '\\' => '']), $m[0]); print_r($result); }
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 19018216307 [1] => Public [2] => ,k]'=system1-system2 [3] => 20230914143505.5 [4] => 1-050000 [5] => No )

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