3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "123 -> x 456 -> y x AND y -> d x OR y -> e x LSHIFT 2 -> f y RSHIFT 2 -> g NOT x -> h NOT y -> i"; $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 [$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 [$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 [~$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 [$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 [$matchesright[1] >> $matchesright[2], $matchesright[3]]; } $matches = null; $simple = preg_match("/(.{1,5})\s->\s(.{1,2})/",$s,$matches); if(count($matches)>0){ return [$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++){ $var = operation($inputs[$i])[1]; $val = operation($inputs[$i])[0]; $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.0070.01418.77
8.3.50.0200.01422.14
8.3.40.0040.01519.28
8.3.30.0070.01119.07
8.3.20.0080.00020.46
8.3.10.0000.00823.48
8.3.00.0090.00019.78
8.2.180.0090.00618.41
8.2.170.0000.01522.96
8.2.160.0110.00420.52
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0080.00019.39
8.2.120.0090.00026.35
8.2.110.0090.00022.37
8.2.100.0060.00618.18
8.2.90.0060.00319.42
8.2.80.0040.00418.16
8.2.70.0000.01118.13
8.2.60.0080.00418.16
8.2.50.0000.00918.13
8.2.40.0030.00622.45
8.2.30.0000.00720.69
8.2.20.0050.00317.96
8.2.10.0060.00318.25
8.2.00.0030.00618.15
8.1.280.0180.00025.92
8.1.270.0060.00320.50
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0030.00622.59
8.1.230.0060.00619.34
8.1.220.0050.00317.91
8.1.210.0030.00518.77
8.1.200.0040.00417.60
8.1.190.0000.00917.50
8.1.180.0050.00318.10
8.1.170.0080.00018.64
8.1.160.0000.00820.82
8.1.150.0070.00018.93
8.1.140.0000.00819.57
8.1.130.0000.00717.87
8.1.120.0000.00717.67
8.1.110.0070.00417.73
8.1.100.0080.00017.63
8.1.90.0000.00717.64
8.1.80.0000.00917.71
8.1.70.0030.00517.73
8.1.60.0040.00417.81
8.1.50.0030.00617.78
8.1.40.0080.00017.64
8.1.30.0030.00617.91
8.1.20.0030.00617.89
8.1.10.0000.00817.77
8.1.00.0050.00317.64
8.0.300.0040.00418.77
8.0.290.0000.00817.13
8.0.280.0070.00018.57
8.0.270.0030.00317.26
8.0.260.0000.00717.30
8.0.250.0040.00417.24
8.0.240.0040.00417.32
8.0.230.0070.00017.18
8.0.220.0030.00417.18
8.0.210.0040.00417.24
8.0.200.0030.00317.23
8.0.190.0040.00417.16
8.0.180.0050.00317.11
8.0.170.0000.01017.26
8.0.160.0040.00417.23
8.0.150.0080.00017.07
8.0.140.0040.00417.08
8.0.130.0060.00313.61
8.0.120.0090.00017.18
8.0.110.0000.00817.21
8.0.100.0000.00717.05
8.0.90.0000.00717.17
8.0.80.0120.01117.20
8.0.70.0040.00417.07
8.0.60.0080.00017.15
8.0.50.0080.00017.09
8.0.30.0080.00917.56
8.0.20.0110.00917.46
8.0.10.0000.00717.30
8.0.00.0090.01017.19
7.4.330.0040.00416.79
7.4.320.0060.00316.79
7.4.300.0030.00516.83
7.4.290.0060.00316.68
7.4.280.0030.00716.90
7.4.270.0060.00316.80
7.4.260.0080.00016.90
7.4.250.0030.00716.75
7.4.240.0050.00516.88
7.4.230.0000.00916.61
7.4.220.0150.00916.95
7.4.210.0100.01316.92
7.4.200.0090.00016.89
7.4.160.0100.01716.96
7.4.150.0140.02117.40
7.4.140.0260.01217.86
7.4.130.0150.02016.88
7.4.120.0180.01516.88
7.4.110.0160.01916.84
7.4.100.0150.01516.88
7.4.90.0220.01716.69
7.4.80.0070.02619.39
7.4.70.0110.01416.79
7.4.60.0200.00716.78
7.4.50.0180.00016.64
7.4.40.0180.01516.86
7.4.30.0110.01616.87
7.4.00.0000.02215.39
7.3.330.0050.00313.66
7.3.320.0040.00413.54
7.3.310.0060.00316.57
7.3.300.0080.00016.72
7.3.290.0040.00416.75
7.3.280.0090.01616.68
7.3.270.0130.01617.40
7.3.260.0270.01016.74
7.3.250.0200.01816.80
7.3.240.0180.01516.78
7.3.230.0130.01616.76
7.3.210.0280.00916.71
7.3.200.0210.00916.57
7.3.190.0190.01016.98
7.3.180.0120.01416.79
7.3.170.0230.00716.70
7.3.160.0150.01716.84
7.3.10.0110.00716.64
7.3.00.0180.00316.70
7.2.330.0210.01016.75
7.2.320.0170.01416.93
7.2.310.0160.00916.95
7.2.300.0150.01216.94
7.2.290.0160.01617.10
7.2.130.0140.00717.23
7.2.120.0060.01616.96
7.2.110.0140.01016.74
7.2.100.0060.01616.75
7.2.90.0160.00616.64
7.2.80.0110.01116.63
7.2.70.0160.00416.84
7.2.60.0080.01117.03
7.2.50.0180.00616.55
7.2.40.0140.01116.86
7.2.30.0120.01216.95
7.2.20.0180.00616.70
7.2.10.0000.02116.82
7.2.00.0050.01018.46
7.1.250.0080.01515.79
7.1.200.0070.00715.97
7.1.100.0100.00318.38
7.1.70.0000.00917.48
7.1.60.0060.02319.52
7.1.50.0210.00835.11
7.1.00.0100.07322.50
7.0.200.0220.00917.00
7.0.60.0130.08319.98
7.0.50.0130.07717.99
7.0.40.0100.09320.23
7.0.30.0300.08020.15
7.0.20.0300.07720.21
7.0.10.0130.09020.18
7.0.00.0170.03720.26
5.6.280.0030.03320.97
5.6.210.0070.08020.50
5.6.200.0070.05018.16
5.6.190.0170.08020.56
5.6.180.0230.04020.47
5.6.170.0330.03720.39
5.6.160.0130.04020.57
5.6.150.0100.04018.19
5.6.140.0100.08718.18
5.6.130.0000.09018.27
5.6.120.0200.07321.18
5.6.110.0070.04321.16
5.6.100.0170.08021.20
5.6.90.0070.09021.07
5.6.80.0200.06020.41
5.5.350.0200.08020.47
5.5.340.0070.04318.06
5.5.330.0070.04320.57
5.5.320.0370.04320.30
5.5.310.0270.08320.24
5.5.300.0070.04018.06
5.5.290.0200.04017.94
5.5.280.0170.07320.85
5.5.270.0070.08720.90
5.5.260.0130.07720.90
5.5.250.0130.08720.61
5.5.240.0000.03320.19

preferences:
43.12 ms | 401 KiB | 5 Q