3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_valid_date($value, $format = 'dd.mm.yyyy'){ if(strlen($value) >= 6 && strlen($format) == 10){ // find separator. Remove all other characters from $format $separator_only = str_replace(array('m','d','y'),'', $format); $separator = $separator_only[0]; // separator is first character if($separator && strlen($separator_only) == 2){ // make regex $regexp = str_replace('mm', '(0?[1-9]|1[0-2])', $format); $regexp = str_replace('dd', '(0?[1-9]|[1-2][0-9]|3[0-1])', $regexp); $regexp = str_replace('yyyy', '(19|20)?[0-9][0-9]', $regexp); $regexp = str_replace($separator, "\\" . $separator, $regexp); if($regexp != $value && preg_match('/'.$regexp.'\z/', $value)){ // check date $arr=explode($separator,$value); $day=$arr[0]; $month=$arr[1]; $year=$arr[2]; if(@checkdate($month, $day, $year)) return true; } } } return false; } var_dump(is_date('22.22.2222', 'mm.dd.yyyy')); // returns false var_dump(is_date('11/30/2008', 'mm/dd/yyyy')); // returns true var_dump(is_date('30-01-2008', 'dd-mm-yyyy')); // returns true var_dump(is_date('2008 01 30', 'yyyy mm dd')); // returns true

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.0160.00618.56
8.3.50.0090.00921.14
8.3.40.0040.01118.83
8.3.30.0140.00019.22
8.3.20.0000.00720.16
8.3.10.0030.00521.92
8.3.00.0070.00022.46
8.2.180.0150.00016.88
8.2.170.0070.00722.96
8.2.160.0100.00720.39
8.2.150.0030.00524.18
8.2.140.0050.00324.66
8.2.130.0060.00926.16
8.2.120.0000.00819.54
8.2.110.0070.00320.31
8.2.100.0090.00319.25
8.2.90.0080.00019.22
8.2.80.0040.00417.97
8.2.70.0080.00017.63
8.2.60.0040.00417.91
8.2.50.0050.00318.07
8.2.40.0060.00318.03
8.2.30.0040.00418.09
8.2.20.0030.00517.72
8.2.10.0000.00717.70
8.2.00.0000.00717.61
8.1.280.0080.00625.92
8.1.270.0050.00320.04
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0030.00623.73
8.1.230.0100.00319.09
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0030.00717.23
8.1.190.0050.00317.50
8.1.180.0040.00418.55
8.1.170.0030.00518.51
8.1.160.0050.00222.13
8.1.150.0040.00418.45
8.1.140.0040.00417.39
8.1.130.0030.00517.70
8.1.120.0070.00017.36
8.1.110.0000.01017.38
8.1.100.0030.00317.26
8.1.90.0070.00017.30
8.1.80.0020.00517.25
8.1.70.0050.00317.35
8.1.60.0040.00417.43
8.1.50.0030.00617.49
8.1.40.0000.00817.39
8.1.30.0030.00517.59
8.1.20.0030.00617.63
8.1.10.0030.00517.47
8.1.00.0040.00417.47
8.0.300.0000.00718.77
8.0.290.0030.00616.93
8.0.280.0000.00718.41
8.0.270.0080.00017.21
8.0.260.0000.00716.72
8.0.250.0000.00717.04
8.0.240.0030.00517.02
8.0.230.0030.00316.86
8.0.220.0000.00716.92
8.0.210.0040.00416.98
8.0.200.0040.00416.98
8.0.190.0070.00016.87
8.0.180.0110.00016.93
8.0.170.0000.00716.95
8.0.160.0040.00416.82
8.0.150.0030.00416.83
8.0.140.0040.00416.81
8.0.130.0030.00313.38
8.0.120.0000.00716.90
8.0.110.0070.00016.80
8.0.100.0050.00316.78
8.0.90.0040.00416.79
8.0.80.0060.01016.96
8.0.70.0000.00816.88
8.0.60.0050.00316.80
8.0.50.0040.00416.95
8.0.30.0130.00617.10
8.0.20.0080.01317.40
8.0.10.0030.00616.95
8.0.00.0100.01016.79
7.4.330.0030.00315.00
7.4.320.0030.00316.41
7.4.300.0030.00316.55
7.4.290.0030.00316.61
7.4.280.0050.00216.57
7.4.270.0040.00316.48
7.4.260.0080.00016.59
7.4.250.0070.00016.45
7.4.240.0020.00516.54
7.4.230.0040.00416.61
7.4.220.0150.00316.54
7.4.210.0080.00816.54
7.4.200.0000.00716.63
7.4.190.0000.00716.61
7.4.160.0120.00616.46
7.4.150.0140.00417.40
7.4.140.0100.00917.86
7.4.130.0080.01216.51
7.4.120.0110.01116.59
7.4.110.0070.01016.32
7.4.100.0030.01416.29
7.4.90.0030.01416.44
7.4.80.0100.00919.39
7.4.70.0060.01216.30
7.4.60.0060.01016.35
7.4.50.0080.00016.15
7.4.40.0080.00822.77
7.4.30.0110.00616.34
7.4.00.0130.00714.73
7.3.330.0020.00213.15
7.3.320.0050.00013.26
7.3.310.0000.00716.20
7.3.300.0060.00016.24
7.3.290.0040.01116.30
7.3.280.0100.00716.25
7.3.270.0030.01517.40
7.3.260.0150.00916.30
7.3.250.0100.00816.47
7.3.240.0100.00716.58
7.3.230.0110.01416.39
7.3.210.0090.00916.51
7.3.200.0110.00719.39
7.3.190.0120.00616.48
7.3.180.0120.00316.53
7.3.170.0110.00516.66
7.3.160.0100.00616.50
7.3.120.0110.01014.71
7.3.110.0090.01414.83
7.3.100.0040.01414.60
7.3.90.0090.00814.77
7.3.80.0070.00814.88
7.3.70.0040.01314.89
7.3.60.0040.01414.85
7.3.50.0100.00914.52
7.3.40.0090.00514.64
7.3.30.0060.01214.58
7.3.20.0050.01116.60
7.3.10.0070.01216.63
7.3.00.0080.00716.41
7.2.330.0030.01316.34
7.2.320.0100.01016.65
7.2.310.0120.00616.64
7.2.300.0120.00416.53
7.2.290.0030.01316.34
7.2.250.0070.01014.94
7.2.240.0080.01514.94
7.2.230.0040.01314.92
7.2.220.0040.00914.93
7.2.210.0070.01014.89
7.2.200.0080.01114.90
7.2.190.0080.01314.82
7.2.180.0050.01214.78
7.2.170.0080.01014.78
7.2.60.0060.00916.79
7.2.00.0100.00719.45
7.1.330.0070.00915.49
7.1.320.0070.00715.61
7.1.310.0040.01215.50
7.1.300.0030.01215.57
7.1.290.0030.01215.61
7.1.280.0090.00715.61
7.1.270.0090.00615.63
7.1.260.0060.00915.39
7.1.200.0030.00715.45
7.1.100.0030.00617.58
7.1.70.0110.00016.98
7.1.60.0070.01819.82
7.1.50.0090.01216.80
7.1.00.0000.05322.47
7.0.200.0030.00716.34
7.0.140.0170.06322.07
7.0.70.3470.03019.98
7.0.60.0100.07320.06
7.0.50.0100.06317.88
7.0.40.0230.07019.95
7.0.30.0730.04720.09
7.0.20.0170.04020.09
7.0.10.0270.05020.08
7.0.00.0030.08720.29
5.6.280.0070.07021.03
5.6.210.0070.06020.76
5.6.200.0130.07718.16
5.6.190.0000.05320.77
5.6.180.0370.07720.46
5.6.170.0230.04720.71
5.6.160.0070.06320.56
5.6.150.0070.03718.24
5.6.140.0100.04318.18
5.6.130.0100.08718.16
5.6.120.0200.05720.99
5.6.110.0070.06721.06
5.6.100.0070.08720.98
5.6.90.0070.07721.01
5.6.80.0030.04020.60
5.6.70.0270.07720.39
5.5.350.0030.08720.45
5.5.340.0100.04718.05
5.5.330.0100.04020.25
5.5.320.0030.04020.13
5.5.310.0300.08020.37
5.5.300.0070.07017.94
5.5.290.0030.07717.92
5.5.280.0070.06020.79
5.5.270.0030.04720.99
5.5.260.0130.08320.77
5.5.250.0100.06720.48
5.5.240.0100.07320.25
5.4.450.0570.04719.39
5.4.440.0870.05319.61
5.4.430.0800.06319.47
5.4.420.0670.06319.63
5.4.410.0670.06019.36
5.4.400.0700.05719.38
5.4.390.0730.05719.26
5.4.380.0330.04018.48
5.4.370.0270.04018.48
5.4.360.0300.05718.77
5.4.350.0080.03412.02
5.4.340.0070.04112.03
5.4.320.0030.03912.51
5.4.310.0090.04612.51
5.4.300.0080.03812.52
5.4.290.0060.04712.52
5.4.280.0040.03712.41
5.4.270.0040.03812.41
5.4.260.0070.04412.41
5.4.250.0170.04018.77
5.4.240.0030.05318.64
5.4.230.0030.05318.93
5.4.220.0130.04718.77
5.4.210.0030.05318.77
5.4.200.0130.04718.77
5.4.190.0070.05318.97
5.4.180.0030.06718.96
5.4.170.0100.05018.99
5.4.160.0070.05718.90
5.4.150.0000.06318.95
5.4.140.0100.07316.40
5.4.130.0100.05016.44
5.4.120.0030.05316.59
5.4.110.0030.05316.61
5.4.100.0100.05716.33
5.4.90.0070.05016.39
5.4.80.0030.05016.59
5.4.70.0100.04316.48
5.4.60.0070.04716.49
5.4.50.0030.07316.31
5.4.40.0100.04716.51
5.4.30.0000.05716.44
5.4.20.0030.07716.33
5.4.10.0100.06316.30
5.4.00.0130.05315.86
5.3.290.0040.04612.80
5.3.280.0100.04714.69
5.3.270.0170.04314.76
5.3.260.0070.05714.70
5.3.250.0100.05014.81
5.3.240.0000.06714.68
5.3.230.0030.05714.70
5.3.220.0030.05314.75
5.3.210.0070.05314.61
5.3.200.0100.04714.67
5.3.190.0000.05714.62
5.3.180.0070.04714.73
5.3.170.0000.05714.74
5.3.160.0100.05314.43
5.3.150.0100.04714.74
5.3.140.0100.04714.59
5.3.130.0100.05014.57
5.3.120.0070.05714.63
5.3.110.0100.04714.65
5.3.100.0000.06014.27
5.3.90.0100.04714.25
5.3.80.0030.05714.00
5.3.70.0100.04314.19
5.3.60.0100.05314.18
5.3.50.0070.04714.02
5.3.40.0170.04314.04
5.3.30.0100.04714.09
5.3.20.0030.05013.71
5.3.10.0000.06313.84
5.3.00.0030.05313.72
5.2.170.0070.04311.33
5.2.160.0030.04711.25
5.2.150.0030.04711.24
5.2.140.0030.04311.14
5.2.130.0100.03711.21
5.2.120.0030.04011.10
5.2.110.0000.04311.29
5.2.100.0100.03311.09
5.2.90.0070.06011.11
5.2.80.0000.04711.18
5.2.70.0030.04011.09
5.2.60.0070.05711.02
5.2.50.0070.04311.11
5.2.40.0000.05311.18
5.2.30.0070.04310.89
5.2.20.0030.04711.15
5.2.10.0000.04310.77
5.2.00.0130.03010.64
5.1.60.0000.0379.97
5.1.50.0030.03310.05
5.1.40.0070.0339.83
5.1.30.0100.03310.51
5.1.20.0000.04010.45
5.1.10.0100.03010.17
5.1.00.0000.03710.15
5.0.50.0000.0308.53
5.0.40.0100.0208.52
5.0.30.0000.0438.34
5.0.20.0070.0278.41
5.0.10.0070.0338.23
5.0.00.0030.0438.19
4.4.90.0070.0205.98
4.4.80.0030.0205.98
4.4.70.0070.0175.98
4.4.60.0030.0205.99
4.4.50.0070.0275.98
4.4.40.0070.0375.98
4.4.30.0030.0205.98
4.4.20.0030.0275.98
4.4.10.0030.0205.98
4.4.00.0130.0235.98
4.3.110.0000.0235.98
4.3.100.0000.0235.98
4.3.90.0130.0135.98
4.3.80.0070.0275.98
4.3.70.0030.0205.98
4.3.60.0000.0235.98
4.3.50.0000.0275.98
4.3.40.0030.0305.98
4.3.30.0000.0235.98
4.3.20.0070.0235.98
4.3.10.0000.0235.98
4.3.00.0100.0207.14

preferences:
44.3 ms | 400 KiB | 5 Q