3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getCode($string) { $code = 0; if (preg_match('/\bred\b/i', $string)) { $code += 2; } if (preg_match('/\bblue\b/i', $string)) { $code += 3; } if (preg_match('/\bgreen\b/i', $string)) { $code += 4; } if ($code === 9) { $code += 2; } if ($code) { return $code; } if (preg_match('/\bballoon\b/i', $string)) { return 1; } return 0; } $sentences = [ 'Here is a green, blue, and red balloon', 'A blue balloon here', 'A red herring', 'Blue is the name of my dog', 'Red and green are Xmas colors', 'blue skies over green grass', 'Foo is bar', 'Have a balloon and a balloon and a balloon', 'A green balloon', 'A blue balloon with a red string', ]; foreach ($sentences as $sentence) { printf("%s => %d\n", $sentence, getCode($sentence)); }

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.0140.00518.75
8.5.00.0100.01020.05
8.4.160.0140.00723.91
8.4.150.0020.00014.05
8.4.140.0100.01117.64
8.4.130.0070.01119.66
8.4.120.0130.00722.54
8.4.110.0080.00319.06
8.4.100.0090.00418.66
8.4.90.0050.00520.45
8.4.80.0140.00418.11
8.4.70.0120.00718.11
8.4.60.0130.00818.82
8.4.50.0100.01118.42
8.4.40.0150.00619.52
8.4.30.0110.00620.60
8.4.20.0030.00717.95
8.4.10.0060.01020.61
8.3.280.0110.01318.69
8.3.270.0140.00716.89
8.3.260.0060.00216.86
8.3.250.0140.00519.01
8.3.240.0130.00618.93
8.3.230.0040.00618.64
8.3.220.0070.00417.11
8.3.210.0090.01016.52
8.3.200.0070.00216.62
8.3.190.0130.00518.84
8.3.180.0050.00717.35
8.3.170.0070.01118.70
8.3.160.0040.00420.43
8.3.150.0090.00917.09
8.3.140.0000.00917.11
8.3.130.0040.00418.44
8.3.120.0060.00319.13
8.3.110.0030.00720.94
8.3.100.0110.00816.69
8.3.90.0040.00426.77
8.3.80.0070.00316.50
8.3.70.0110.00716.63
8.3.60.0110.00718.55
8.3.50.0070.00720.60
8.3.40.0080.00819.10
8.3.30.0070.00719.34
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0130.00320.61
8.2.280.0070.00418.80
8.2.270.0110.01117.34
8.2.260.0000.00918.61
8.2.250.0080.00017.05
8.2.240.0070.01017.17
8.2.230.0040.00422.58
8.2.220.0060.00324.06
8.2.210.0050.00326.77
8.2.200.0000.00916.50
8.2.190.0090.00616.58
8.2.180.0120.00925.92
8.2.170.0110.00419.08
8.2.160.0060.00922.96
8.2.150.0080.00025.66
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0080.00026.16
8.2.110.0080.00321.05
8.2.100.0060.00917.97
8.2.90.0030.00617.88
8.2.80.0080.00017.97
8.2.70.0060.00317.88
8.2.60.0070.00318.16
8.2.50.0030.00618.07
8.2.40.0030.00618.28
8.2.30.0050.00318.16
8.2.20.0000.00820.40
8.2.10.0000.00817.77
8.2.00.0000.00719.19
8.1.330.0080.01121.91
8.1.320.0110.00819.86
8.1.310.0080.00618.50
8.1.300.0070.01318.56
8.1.290.0090.00030.84
8.1.280.0070.01425.92
8.1.270.0080.00023.99
8.1.260.0060.00326.35
8.1.250.0110.00028.09
8.1.240.0030.00722.75
8.1.230.0070.00317.83
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0030.00617.48
8.1.190.0060.00317.35
8.1.180.0030.00518.10
8.1.170.0040.00418.71
8.1.160.0040.00418.80
8.1.150.0040.00418.84
8.1.140.0050.00517.62
8.1.130.0030.00618.98
8.1.120.0040.00417.47
8.1.110.0040.00417.63
8.1.100.0000.00717.66
8.1.90.0030.00517.63
8.1.80.0030.00517.52
8.1.70.0000.00717.58
8.1.60.0000.00917.75
8.1.50.0060.00317.70
8.1.40.0000.00717.70
8.1.30.0000.00817.82
8.1.20.0040.00417.79
8.1.10.0090.00017.62
8.1.00.0030.00517.49
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0040.00418.39
8.0.270.0050.00318.17
8.0.260.0030.00318.39
8.0.250.0000.00717.14
8.0.240.0000.00817.04
8.0.230.0000.00817.13
8.0.220.0070.00017.11
8.0.210.0080.00017.09
8.0.200.0070.00016.94
8.0.190.0000.00817.16
8.0.180.0050.00316.99
8.0.170.0030.00616.90
8.0.160.0000.00717.01
8.0.150.0050.00216.86
8.0.140.0000.00716.89
8.0.130.0000.00816.95
8.0.120.0030.00517.04
8.0.110.0000.00716.86
8.0.100.0000.00716.99
8.0.90.0080.00017.01
8.0.80.0070.00017.06
8.0.70.0050.00216.87
8.0.60.0050.00217.01
8.0.50.0040.00416.93
8.0.30.0030.00516.93
8.0.20.0040.00416.98
8.0.10.0050.00317.15
7.4.330.0060.00015.55
7.4.320.0000.00816.83
7.4.300.0000.00616.74
7.4.290.0000.00716.57
7.4.280.0030.00316.67
7.4.270.0070.00016.78
7.4.260.0070.00016.79
7.4.250.0070.00016.68
7.4.240.0070.00016.76
7.4.230.0000.00716.69
7.4.220.0000.00716.69
7.4.210.0080.00016.79
7.4.200.0000.00716.70
7.4.190.0070.00016.84
7.4.180.0000.00816.85
7.4.160.0040.00416.80
7.4.150.0050.00316.86
7.4.140.0040.00416.59
7.4.130.0030.00316.66
7.4.120.0000.00716.50
7.4.110.0030.00316.74
7.4.100.0000.00716.80
7.4.90.0080.00016.68
7.4.80.0000.00716.75
7.4.70.0070.00016.52
7.4.60.0000.00816.64
7.4.50.0070.00016.63
7.4.40.0080.00016.78
7.4.30.0050.00216.68
7.4.20.0030.00316.74
7.4.10.0030.00316.55
7.4.00.0050.00216.59

preferences:
159.21 ms | 403 KiB | 5 Q