3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = <<<'EOD' 19018216307,Public,\,k]'=system1-system2,20230914143505.5,1-050000,No 32432151322,Public,blublabliblo,1324651651654.5,1-050000,No EOD; // change $filePath with the path of your file $filePath = 'data:text/plain;base64,' . base64_encode($str); if (false === $handle = fopen($filePath, 'r')) die("unable to open file $filePath"); $pattern = <<<'REGEX' ~(?nxx) (?# modifiers: - inline n: parenthesis act as a non-capturing group - inline xx: white-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, except escaped characters) # final check ( \z (*:END) )? # define a marker if the end of the string is reached ~A REGEX; $result = []; // stream_get_line doesn't return the newline sequence (3rd parameter) // change it to \r\n or \r if needed, or use fgets and change \z with $ in the pattern while(false !== $line = stream_get_line($handle, 1024, "\n")) { if (preg_match_all($pattern, $line, $m) && isset($m['MARK'])) { $fields = array_map(fn($s) => strtr($s, ['\\\\' => '\\', '\\' => '']), $m[0]); $result[] = $fields; } else { die("unable to parse the following line:\n$line"); } } fclose($handle); print_r($result);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.10.0090.00917.01
8.5.00.0130.01120.30
8.4.160.0110.01224.08
8.4.150.0020.00014.05
8.4.140.0110.01117.72
8.4.130.0110.00918.00
8.4.120.0100.00724.19
8.4.110.0120.00923.59
8.4.100.0140.00718.88
8.4.90.0090.01120.57
8.4.80.0110.00918.11
8.4.70.0140.00817.94
8.4.60.0140.00724.30
8.4.50.0100.01024.07
8.4.40.0110.00018.12
8.4.30.0140.00322.34
8.4.20.0100.01418.74
8.4.10.0090.00019.63
8.3.280.0110.01018.63
8.3.270.0090.01316.89
8.3.260.0150.00417.22
8.3.250.0120.00719.08
8.3.240.0120.00717.10
8.3.230.0050.00416.79
8.3.220.0040.00419.09
8.3.210.0110.00718.68
8.3.200.0050.00416.80
8.3.190.0100.01019.07
8.3.180.0100.00516.86
8.3.170.0150.00418.87
8.3.160.0130.00618.59
8.3.150.0040.01820.66
8.3.140.0040.00417.10
8.3.130.0030.00617.10
8.3.120.0030.00619.01
8.3.110.0090.00020.94
8.3.100.0070.01016.80
8.3.90.0110.00426.77
8.3.80.0060.00617.97
8.3.70.0070.01518.43
8.3.60.0140.00716.75
8.3.50.0140.00716.95
8.3.40.0110.00420.17
8.3.30.0090.01121.71
8.3.20.0070.01124.18
8.3.10.0030.00524.66
8.3.00.0040.00426.16
8.2.290.0070.00820.75
8.2.280.0110.00818.87
8.2.270.0060.00617.35
8.2.260.0140.00420.21
8.2.250.0130.00617.07
8.2.240.0060.00317.38
8.2.230.0030.00722.58
8.2.220.0060.00324.06
8.2.210.0140.00626.77
8.2.200.0070.00416.63
8.2.190.0120.00616.88
8.2.180.0110.01118.61
8.2.170.0030.01218.89
8.2.160.0100.00322.96
8.2.150.0040.01125.66
8.2.140.0130.00324.66
8.2.130.0180.00026.16
8.2.120.0050.00320.20
8.2.110.0140.00722.22
8.1.330.0070.00421.98
8.1.320.0140.00718.71
8.1.310.0110.00718.48
8.1.300.0080.00018.40
8.1.290.0060.00630.84
8.1.280.0070.00725.92
8.1.270.0140.00323.96
8.1.260.0060.00326.35
8.1.250.0140.00328.09
8.1.240.0060.00319.27

preferences:
72.34 ms | 403 KiB | 5 Q