3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "1 AND 2 -> a"; $inputs = explode("\n", $input); function operation($s){ $matchesand = null; $and = preg_match("/(.{1,2})\sAND\s(.{1,2})\s->\s(.{1,2})/",$s,$matchesand); if(count($matchesand)>0){ return [1,$matchesand[1] , $matchesand[2], $matchesand[3]]; } $matchesor= null; $or = preg_match("/(.{1,2})\sOR\s(.{1,2})\s->\s(.{1,2})/",$s,$matchesor); if(count($matchesor)>0){ return [2,$matchesor[1] , $matchesor[2], $matchesor[3]]; } $matchesnot = null; $not = preg_match("/NOT\s(.{1,2})\s->\s(.{1,2})/",$s,$matchesnot); if(count($matchesnot)>0){ return [3,$matchesnot[1], $matchesnot[2]]; } $matchesleft = null; $left = preg_match("/(.{1,2})\sLSHIFT\s(.{1,2})\s->\s(.{1,2})/",$s,$matchesleft); if(count($matchesleft)>0){ return [4,$matchesleft[1] , $matchesleft[2], $matchesleft[3]]; } $matchesright = null; $right = preg_match("/(.{1,2})\sRSHIFT\s(.{1,2})\s->\s(.{1,2})/",$s,$matchesright); if(count($matchesright)>0){ return [5,$matchesright[1] , $matchesright[2], $matchesright[3]]; } $matches = null; $simple = preg_match("/(.{1,5})\s->\s(.{1,2})/",$s,$matches); if(count($matches)>0){ return [6,$matches[1], $matches[2]]; } } $array=[]; for($i = 'a'; $i<'z'; $i++){ $array[$i]=0; } for($i = 'a'; $i<'z'; $i++){ for($j = 'a'; $j<'z'; $j++){ $array[$i.$j]=0; } } for($i = 0; $i<count($inputs); $i++){ $values = operation($inputs[i]); if($operation[0] === 1){ $array[$values[3]] = $array[$values[1]] & $array[$values[2]]; } $array[$var] = $val; } var_dump($array); ?>

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.3.60.0150.00617.13
8.3.50.0120.00722.03
8.3.40.0120.00319.09
8.3.30.0140.00018.78
8.3.20.0040.00420.39
8.3.10.0040.00423.48
8.3.00.0080.00019.91
8.2.180.0120.00318.41
8.2.170.0090.00622.96
8.2.160.0140.00020.55
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0060.00319.20
8.2.120.0080.00026.35
8.2.110.0090.00020.72
8.2.100.0040.00818.09
8.2.90.0040.00419.48
8.2.80.0030.00618.05
8.2.70.0060.00317.75
8.2.60.0040.00718.17
8.2.50.0000.00918.07
8.2.40.0040.00422.16
8.2.30.0040.00420.75
8.2.20.0000.00817.77
8.2.10.0000.00818.23
8.2.00.0060.00318.25
8.1.280.0100.00325.92
8.1.270.0080.00020.55
8.1.260.0070.00028.09
8.1.250.0050.00328.09
8.1.240.0060.01521.69
8.1.230.0080.00422.65
8.1.220.0040.00417.91
8.1.210.0000.00818.77
8.1.200.0090.00017.38
8.1.190.0030.00617.38
8.1.180.0060.00318.10
8.1.170.0000.00818.62
8.1.160.0060.00320.85
8.1.150.0000.00719.01
8.1.140.0040.00419.71
8.1.130.0000.00717.75
8.1.120.0050.00217.54
8.1.110.0060.00617.52
8.1.100.0040.00417.62
8.1.90.0000.00817.56
8.1.80.0000.00717.52
8.1.70.0000.00717.44
8.1.60.0000.00817.61
8.1.50.0060.00317.64
8.1.40.0040.00417.50
8.1.30.0000.00817.80
8.1.20.0000.00817.70
8.1.10.0080.00017.66
8.1.00.0080.00017.54
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0050.00318.53
8.0.270.0030.00317.23
8.0.260.0080.00017.40
8.0.250.0000.00716.99
8.0.240.0000.00817.14
8.0.230.0000.00717.10
8.0.220.0030.00316.90
8.0.210.0000.00717.03
8.0.200.0000.00616.98
8.0.190.0030.00517.09
8.0.180.0020.00516.95
8.0.170.0110.00017.09
8.0.160.0050.00217.06
8.0.150.0050.00317.08
8.0.140.0050.00216.89
8.0.130.0040.00413.43
8.0.120.0050.00317.00
8.0.110.0000.00817.09
8.0.100.0040.00417.16
8.0.90.0000.00716.99
8.0.80.0100.01017.02
8.0.70.0000.00717.02
8.0.60.0040.00417.10
8.0.50.0050.00216.83
8.0.30.0040.01317.28
8.0.20.0090.00917.43
8.0.10.0000.00717.03
8.0.00.0110.01016.75
7.4.330.0000.00616.72
7.4.320.0060.00316.94
7.4.300.0080.00416.91
7.4.290.0100.00016.79
7.4.280.0060.00316.90
7.4.270.0060.00316.87
7.4.260.0030.00716.94
7.4.250.0050.00516.89
7.4.240.0070.00316.91
7.4.230.0060.00316.94
7.4.220.0200.00616.98
7.4.210.0110.01316.93
7.4.200.0060.00316.72
7.4.160.0190.00916.58
7.4.150.0330.00017.40
7.4.140.0160.01517.86
7.4.130.0160.01716.85
7.4.120.0160.01416.98
7.4.110.0130.01816.89
7.4.100.0180.01816.87
7.4.90.0070.02116.86
7.4.80.0250.00319.39
7.4.70.0030.02216.74
7.4.60.0120.01216.90
7.4.50.0150.00316.98
7.4.40.0180.01316.77
7.4.30.0120.01216.76
7.4.00.0140.01115.52
7.3.330.0080.00013.68
7.3.320.0000.00713.62
7.3.310.0040.00416.66
7.3.300.0080.00016.71
7.3.290.0030.00516.61
7.3.280.0130.00916.62
7.3.270.0140.01817.40
7.3.260.0170.01716.65
7.3.250.0240.01116.73
7.3.240.0160.01416.79
7.3.230.0110.01816.71
7.3.210.0210.00916.73
7.3.200.0190.00816.62
7.3.190.0110.01416.59
7.3.180.0150.01816.90
7.3.170.0150.01216.82
7.3.160.0250.01816.70
7.3.10.0120.00416.62
7.3.00.0070.01016.80
7.2.330.0190.01516.95
7.2.320.0090.01916.75
7.2.310.0110.01516.87
7.2.300.0220.01517.08
7.2.290.0060.02017.01
7.2.130.0130.01016.77
7.2.120.0000.01717.15
7.2.110.0090.00917.25
7.2.100.0070.01016.99
7.2.90.0120.00616.94
7.2.80.0030.01016.76
7.2.70.0000.01417.26
7.2.60.0080.01017.05
7.2.50.0200.00016.80
7.2.40.0120.00417.14
7.2.30.0070.01017.30
7.2.20.0150.00717.14
7.2.10.0100.00617.21
7.2.00.0070.00918.37
7.1.250.0060.00815.91
7.1.200.0060.01015.97
7.1.100.0080.00818.25
7.1.70.0090.00017.13
7.1.60.0150.01519.52
7.1.50.0310.00734.77
7.1.00.0030.08022.48
7.0.200.0240.00716.75
7.0.60.0070.07719.88
7.0.50.0070.07018.01
7.0.40.0130.08320.12
7.0.30.0500.07320.33
7.0.20.0330.06720.19
7.0.10.0100.09320.12
7.0.00.0100.08720.26
5.6.280.0100.02720.96
5.6.210.0200.04720.54
5.6.200.0030.05018.14
5.6.190.0130.08720.68
5.6.180.0230.04320.54
5.6.170.0400.08020.55
5.6.160.0200.07720.55
5.6.150.0030.08018.19
5.6.140.0070.08718.22
5.6.130.0100.08018.27
5.6.120.0070.08021.05
5.6.110.0170.08720.95
5.6.100.0070.06021.03
5.6.90.0100.07721.05
5.6.80.0230.05320.55
5.5.350.0170.04020.40
5.5.340.0200.07017.96
5.5.330.0030.04320.25
5.5.320.0330.05020.32
5.5.310.0400.07020.37
5.5.300.0070.06717.93
5.5.290.0130.07718.09
5.5.280.0100.06721.00
5.5.270.0030.05320.68
5.5.260.0100.08320.83
5.5.250.0100.07720.71
5.5.240.0300.07020.39

preferences:
62.23 ms | 401 KiB | 5 Q