3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regex = <<<REGEX / #starting pattern delimiter (?> #starting atomic group, intended for performance ( #capture group 1 \[ #literal opening square brace (?: #non-capturing group for logic encapsulation (?> #starting atomic group, intended for performance [^[\]]+ #negate character class to match one or more non-square brace characters ) #closing atomic group | #or (?1) #recurse the subpattern contained within the first capture group )* #close non-capturing group and allow it to be repeated zero or more times \] #literal closing square brace ) #close capture group 1 | #or [^,[\]]+ #negate character class to match one or more non-square brace characters and non-commas )+ #close atomic group and require one or more matches of internal logic \K #forget previously matched characters to prevent losing them during splitting ,? #optionally match a comma /x REGEX; /* (cannot comment after pattern end) x modifier enables inline regex commenting */ var_export( preg_split( $regex, /* '/(?>(\[(?:(?>[^[\]]+)|(?1))*\])|[^,[\]]+)+\K,?/', */ "first,second[,b],third[a,b[1,2,3]],fourth[a[1,2]],sixth", 0, PREG_SPLIT_NO_EMPTY ) );

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.0120.00818.48
8.5.00.0140.00820.27
8.4.160.0120.01022.21
8.4.150.0020.00014.05
8.4.140.0140.00717.88
8.4.130.0100.01017.98
8.4.120.0100.01120.50
8.4.110.0050.00322.30
8.4.100.0150.00618.02
8.4.90.0100.01018.57
8.4.80.0130.00717.68
8.4.70.0120.00919.67
8.4.60.0120.01118.00
8.4.50.0120.00818.46
8.4.40.0000.02017.68
8.4.30.0080.01118.86
8.4.20.0070.01321.44
8.4.10.0150.00919.58
8.3.280.0120.00820.08
8.3.270.0090.01416.88
8.3.260.0040.00516.86
8.3.250.0120.00618.63
8.3.240.0090.01016.74
8.3.230.0050.00416.68
8.3.220.0100.00216.93
8.3.210.0100.00816.75
8.3.200.0060.00216.66
8.3.190.0080.01019.16
8.3.180.0120.00717.05
8.3.170.0000.01818.80
8.3.160.0070.00316.66
8.3.150.0040.01417.30
8.3.140.0040.00420.60
8.3.130.0060.00616.85
8.3.120.0030.00620.62
8.3.110.0090.00020.94
8.3.100.0060.00316.78
8.3.90.0020.00526.77
8.3.80.0000.01016.63
8.3.70.0190.00316.75
8.3.60.0210.00416.50
8.3.50.0000.01316.80
8.3.40.0220.00017.38
8.3.30.0200.00017.59
8.3.20.0150.00417.25
8.3.10.0210.00017.47
8.3.00.0140.00617.50
8.2.290.0080.01020.19
8.2.280.0090.00616.67
8.2.270.0140.00317.13
8.2.260.0030.00618.39
8.2.250.0080.00018.48
8.2.240.0090.00018.75
8.2.230.0030.00622.58
8.2.220.0080.00024.06
8.2.210.0110.00726.77
8.2.200.0220.00016.50
8.2.190.0170.00316.38
8.2.180.0150.00516.75
8.2.170.0150.00817.63
8.2.160.0160.00817.46
8.2.150.0090.01417.50
8.2.140.0220.00017.63
8.2.130.0180.00417.25
8.2.120.0190.00517.50
8.2.110.0150.01217.60
8.2.100.0230.00017.75
8.2.90.0140.00717.38
8.2.80.0190.00417.50
8.2.70.0240.00017.13
8.2.60.0180.00617.38
8.2.50.0180.00517.38
8.2.40.0210.00317.23
8.2.30.0180.00417.35
8.2.20.0090.01117.50
8.2.10.0200.00017.48
8.2.00.0150.00617.50
8.1.330.0090.01020.46
8.1.320.0110.00916.59
8.1.310.0090.00918.25
8.1.300.0080.00016.50
8.1.290.0160.00816.25
8.1.280.0190.00516.38
8.1.270.0200.00417.25
8.1.260.0170.00717.48
8.1.250.0180.00417.22
8.1.240.0110.00717.38
8.1.230.0220.00017.23
8.1.220.0130.00717.23
8.1.210.0090.01317.22
8.1.200.0230.00017.11
8.1.190.0140.00816.98
8.1.180.0190.00017.25
8.1.170.0190.00017.25
8.1.160.0180.00317.13
8.1.150.0140.00617.13
8.1.140.0150.00517.00
8.1.130.0210.00017.38
8.1.120.0190.00017.38
8.1.110.0170.00317.25
8.1.100.0040.00717.47
8.1.90.0000.01317.34
8.1.80.0050.00517.22
8.1.70.0080.00417.13
8.1.60.0040.00717.23
8.1.50.0100.00017.38
8.1.40.0070.00317.60
8.1.30.0030.00717.63
8.1.20.0040.00717.25
8.1.10.0070.00417.50
8.1.00.0070.00417.25

preferences:
41.46 ms | 403 KiB | 5 Q