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 [~$matchesand[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.0180.00418.80
8.3.50.0140.00822.25
8.3.40.0040.01519.25
8.3.30.0090.00619.04
8.3.20.0050.00320.18
8.3.10.0040.00423.63
8.3.00.0040.00419.81
8.2.180.0040.01118.41
8.2.170.0040.01122.96
8.2.160.0030.01020.51
8.2.150.0050.00325.66
8.2.140.0050.00324.66
8.2.130.0030.00621.24
8.2.120.0080.00026.35
8.2.110.0030.00622.33
8.2.100.0040.00818.05
8.2.90.0000.00819.30
8.2.80.0060.00318.13
8.2.70.0070.00318.25
8.2.60.0040.00818.05
8.2.50.0090.00018.13
8.2.40.0000.00922.16
8.2.30.0050.00320.74
8.2.20.0050.00317.93
8.2.10.0080.00018.25
8.2.00.0090.00018.13
8.1.280.0060.00925.92
8.1.270.0060.00320.50
8.1.260.0050.00328.09
8.1.250.0040.00428.09
8.1.240.0110.00020.95
8.1.230.0080.00419.34
8.1.220.0000.00817.74
8.1.210.0030.00518.77
8.1.200.0000.01017.60
8.1.190.0060.00317.38
8.1.180.0000.00818.10
8.1.170.0050.00318.91
8.1.160.0040.00420.89
8.1.150.0000.00719.01
8.1.140.0060.00319.60
8.1.130.0000.00817.74
8.1.120.0000.00717.60
8.1.110.0050.00617.58
8.1.100.0040.00417.72
8.1.90.0000.00717.74
8.1.80.0040.00417.69
8.1.70.0000.00717.59
8.1.60.0000.00917.84
8.1.50.0040.00417.78
8.1.40.0000.00817.69
8.1.30.0040.00417.82
8.1.20.0030.00517.86
8.1.10.0040.00417.69
8.1.00.0040.00417.74
8.0.300.0000.00818.77
8.0.290.0040.00417.00
8.0.280.0030.00318.61
8.0.270.0040.00417.25
8.0.260.0050.00317.25
8.0.250.0030.00317.26
8.0.240.0040.00417.28
8.0.230.0000.00717.25
8.0.220.0000.00717.21
8.0.210.0080.00017.07
8.0.200.0070.00017.22
8.0.190.0030.00517.25
8.0.180.0000.00817.05
8.0.170.0000.01017.27
8.0.160.0000.00817.22
8.0.150.0000.00917.20
8.0.140.0000.00817.20
8.0.130.0030.00613.63
8.0.120.0040.00417.11
8.0.110.0050.00317.25
8.0.100.0040.00417.27
8.0.90.0000.00817.09
8.0.80.0060.01017.19
8.0.70.0000.00817.27
8.0.60.0000.00817.10
8.0.50.0030.00517.06
8.0.30.0110.01117.44
8.0.20.0140.00817.43
8.0.10.0040.00417.38
8.0.00.0110.00717.00
7.4.330.0000.00516.68
7.4.320.0040.00416.77
7.4.300.0060.00016.71
7.4.290.0000.00816.82
7.4.280.0050.00216.83
7.4.270.0070.00016.93
7.4.260.0000.00816.80
7.4.250.0030.00716.92
7.4.240.0040.00416.84
7.4.230.0000.00716.84
7.4.220.0030.01317.02
7.4.210.0100.00716.83
7.4.200.0020.00516.70
7.4.160.0060.00916.90
7.4.150.0060.01217.40
7.4.140.0140.00917.86
7.4.130.0140.00516.80
7.4.120.0100.00716.78
7.4.110.0120.00616.72
7.4.100.0100.01316.85
7.4.90.0090.00917.04
7.4.80.0120.01319.39
7.4.70.0070.01016.78
7.4.60.0090.00916.98
7.4.50.0030.01316.78
7.4.40.0110.00616.75
7.4.30.0100.00716.78
7.4.00.0070.01015.41
7.3.330.0000.00613.70
7.3.320.0050.00013.54
7.3.310.0040.00416.57
7.3.300.0080.00016.60
7.3.290.0000.00716.54
7.3.280.0070.00916.67
7.3.270.0090.00917.40
7.3.260.0110.00816.66
7.3.250.0100.00916.78
7.3.240.0080.01116.74
7.3.230.0090.01016.67
7.3.210.0060.01216.63
7.3.200.0040.01216.63
7.3.190.0030.01516.59
7.3.180.0120.00616.65
7.3.170.0120.01116.68
7.3.160.0130.01316.70
7.3.10.0040.00716.68
7.3.00.0090.00616.95
7.2.330.0120.01317.11
7.2.320.0080.01117.10
7.2.310.0070.01017.02
7.2.300.0090.00916.97
7.2.290.0120.00616.91
7.2.130.0000.00917.13
7.2.120.0030.01017.27
7.2.110.0080.00417.21
7.2.100.0060.00917.04
7.2.90.0070.01017.25
7.2.80.0030.00717.11
7.2.70.0130.00317.34
7.2.60.0020.01417.02
7.2.50.0070.01017.24
7.2.40.0080.00417.04
7.2.30.0000.01817.25
7.2.20.0030.01317.11
7.2.10.0000.01417.25
7.2.00.0110.00518.43
7.1.250.0110.00415.77
7.1.200.0060.00916.18
7.1.100.0030.01017.98
7.1.70.0030.00817.30
7.1.60.0130.01319.52
7.1.50.0190.01635.01
7.1.00.0070.07322.48
7.0.200.0310.01016.97
7.0.60.0070.04019.89
7.0.50.0170.04317.89
7.0.40.0130.04320.27
7.0.30.0300.08320.32
7.0.20.0370.07320.13
7.0.10.0130.05320.27
7.0.00.0070.08320.25
5.6.280.0000.03321.01
5.6.210.0100.07720.70
5.6.200.0100.08718.20
5.6.190.0070.09020.55
5.6.180.0200.04020.51
5.6.170.0500.07020.52
5.6.160.0030.04720.57
5.6.150.0070.07018.25
5.6.140.0030.06318.17
5.6.130.0100.07718.14
5.6.120.0070.04321.13
5.6.110.0130.04321.03
5.6.100.0100.08020.94
5.6.90.0030.08721.16
5.6.80.0000.06020.40
5.5.350.0170.06720.45
5.5.340.0100.07718.09
5.5.330.0070.03720.45
5.5.320.0230.03720.45
5.5.310.0430.06720.30
5.5.300.0070.03718.07
5.5.290.0070.04017.96
5.5.280.0100.06720.91
5.5.270.0130.08320.90
5.5.260.0100.08020.82
5.5.250.0070.07720.62
5.5.240.0270.08020.22

preferences:
45.16 ms | 401 KiB | 5 Q