3v4l.org

run code in 300+ PHP versions simultaneously
<?php # https://stackoverflow.com/a/32451875/429071 # Will accept any string along as it _also_ contains a single uppercase or number character $str = "Has a single uppercase character only."; $pattern = '/[A-Z0-9]/'; checkStringForPattern($str, $pattern); # https://stackoverflow.com/a/32451873/429071 # Will accept any string as long as it contains _either_ an uppercase or number character $str = "WILLACCEPTTHISSTRING"; $pattern = '/^[A-Z0-9]+$/'; checkStringForPattern($str, $pattern); $str = "0123456789"; $pattern = '/^[A-Z0-9]+$/'; checkStringForPattern($str, $pattern); # The following regex will need *both* types $pattern = "/^(?=.*[A-Z])(?=.*[0-9])[A-Z0-9]*$/"; $str = "WILLFAILBECAUSEITONLYCONTAINSLETTERS"; checkStringForPattern($str, $pattern); $str = "0123456789"; checkStringForPattern($str, $pattern); function checkStringForPattern($str, $pattern){ if(preg_match($pattern, $str)){ var_dump("The [$pattern] pattern accepts the [$str] string."); }else{ var_dump("The [$pattern] does NOT accept the [$str] string."); } }

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.30.0120.00517.54
8.5.20.0090.00819.63
8.5.10.0110.00620.03
8.5.00.0130.01122.02
8.4.180.0100.01121.99
8.4.170.0170.00520.38
8.4.160.0130.00923.88
8.4.150.0030.00316.96
8.4.140.0110.01317.78
8.4.130.0060.00318.63
8.4.120.0140.00524.22
8.4.110.0090.00318.66
8.4.100.0100.00717.90
8.4.90.0100.01218.61
8.4.80.0120.00918.02
8.4.70.0050.00718.22
8.4.60.0130.00718.93
8.4.50.0130.00817.92
8.4.40.0070.01318.05
8.4.30.0070.01018.96
8.4.20.0130.00618.03
8.4.10.0130.00721.80
8.3.300.0130.00820.93
8.3.290.0110.01120.81
8.3.280.0120.00918.51
8.3.270.0100.00916.74
8.3.260.0140.00616.62
8.3.250.0100.00518.98
8.3.240.0110.00717.21
8.3.230.0130.00816.90
8.3.220.0110.00717.17
8.3.210.0090.01016.77
8.3.200.0040.00516.78
8.3.190.0090.01019.05
8.3.180.0130.00716.52
8.3.170.0100.01019.02
8.3.160.0110.00016.66
8.3.150.0180.00020.86
8.3.140.0110.00718.71
8.3.130.0170.00318.71
8.3.120.0000.00920.56
8.3.110.0070.00320.94
8.3.100.0100.00018.64
8.3.90.0060.00326.77
8.3.80.0030.00616.59
8.3.70.0100.00716.63
8.3.60.0070.01516.73
8.3.50.0070.01420.34
8.3.40.0140.00020.46
8.3.30.0110.00921.57
8.3.20.0070.00024.18
8.3.10.0090.00024.66
8.3.00.0040.00426.16
8.2.300.0120.00821.87
8.2.290.0050.00420.56
8.2.280.0040.00419.13
8.2.270.0200.00016.90
8.2.260.0040.01120.16
8.2.250.0070.00416.90
8.2.240.0060.00319.04
8.2.230.0080.00322.58
8.2.220.0030.00637.54
8.2.210.0040.00426.77
8.2.200.0090.00018.30
8.2.190.0050.01416.58
8.2.180.0160.00325.92
8.2.170.0120.00318.91
8.2.160.0100.00322.96
8.2.150.0000.00725.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00421.17
8.2.110.0060.00320.52
8.2.100.0030.00620.40
8.1.340.0130.00621.59
8.1.330.0090.00922.25
8.1.320.0050.00316.38
8.1.310.0030.00516.82
8.1.300.0060.00320.01
8.1.290.0030.00630.84
8.1.280.0150.00025.92
8.1.270.0060.00323.90
8.1.260.0070.01126.35
8.1.250.0080.00028.09
8.1.240.0060.00318.61
8.1.230.0030.00918.76
7.4.300.0050.00216.65

preferences:
57.1 ms | 898 KiB | 5 Q