3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyDateTime extends DateTime { public static function createFromFormat($format, $time, $timezone = null) { $version = explode('.', phpversion()); if(!$timezone) $timezone = new DateTimeZone(date_default_timezone_get()); if(((int)$version[0] >= 5 && (int)$version[1] >= 2 && (int)$version[2] > 17)){ return parent::createFromFormat($format, $time, $timezone); } $schedule = $time; $schedule_format = str_replace(array('Y','m','d', 'H', 'i','a'),array('%Y','%m','%d', '%I', '%M', '%p' ) ,$format); // %Y, %m and %d correspond to date()'s Y m and d. // %I corresponds to H, %M to i and %p to a $ugly = strptime($schedule, $schedule_format); $ymd = sprintf( // This is a format string that takes six total decimal // arguments, then left-pads them with zeros to either // 4 or 2 characters, as needed '%04d-%02d-%02d %02d:%02d:%02d', $ugly['tm_year'] + 1900, // This will be "111", so we need to add 1900. $ugly['tm_mon'] + 1, // This will be the month minus one, so we add one. $ugly['tm_mday'], $ugly['tm_hour'], $ugly['tm_min'], $ugly['tm_sec'] ); $new_schedule = new DateTime($ymd); return $new_schedule; return new DateTime(date($format, strtotime($time)), $timezone); } } $dateTime = MyDateTime::createFromFormat('dmY', '13062013'); var_dump($dateTime); var_dump($dateTime->format('dmY'));

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)
7.3.00.0040.01716.86
7.2.130.0110.01516.55
7.2.120.0160.00716.79
7.2.110.0100.01317.13
7.2.100.0100.01017.10
7.2.90.0150.00817.14
7.2.80.0070.01117.03
7.2.70.0090.00617.11
7.2.60.0090.00717.03
7.2.50.0140.00717.06
7.2.40.0130.00317.13
7.2.30.0030.01417.01
7.2.20.0040.01217.13
7.2.10.0060.00816.65
7.2.00.0040.00818.16
7.1.250.0140.01115.94
7.1.240.0170.00615.83
7.1.230.0200.00515.69
7.1.220.0130.01015.98
7.1.210.0150.00315.70
7.1.200.0110.01115.94
7.1.190.0100.00715.75
7.1.180.0120.00416.03
7.1.170.0080.00816.04
7.1.160.0120.00415.81
7.1.150.0120.00315.65
7.1.140.0030.01316.14
7.1.130.0060.00915.91
7.1.120.0100.01015.42
7.1.110.0140.00015.62
7.1.100.0050.00917.35
7.1.90.0100.00715.84
7.1.80.0160.00315.75
7.1.70.0060.00816.66
7.1.60.0060.01117.58
7.1.50.0060.01216.55
7.1.40.0100.00615.75
7.1.30.0130.00715.83
7.1.20.0160.00615.91
7.1.10.0080.01615.71
7.1.00.0090.04019.17
7.0.330.0120.00715.53
7.0.320.0140.00315.53
7.0.310.0060.00915.75
7.0.300.0070.01015.49
7.0.290.0110.00415.54
7.0.280.0100.00315.35
7.0.270.0040.01515.26
7.0.260.0110.00315.24
7.0.250.0090.00915.46
7.0.240.0030.01215.65
7.0.230.0130.01015.73
7.0.220.0120.00615.48
7.0.210.0130.00315.67
7.0.200.0040.01016.35
7.0.190.0150.00915.35
7.0.180.0110.01115.54
7.0.170.0150.00415.39
7.0.160.0070.00715.67
7.0.150.0130.00515.44
7.0.140.0070.04018.66
7.0.130.0080.01215.28
7.0.120.0110.00715.14
7.0.110.0090.01015.38
7.0.100.0060.00915.44
7.0.90.0130.01015.52
7.0.80.0110.00815.31
7.0.70.0140.00315.56
7.0.60.0150.04017.63
7.0.50.0090.04716.82
7.0.40.0060.04916.87
7.0.30.0230.02816.82
7.0.20.0190.04017.00
7.0.10.0070.04616.95
7.0.00.0110.04516.95
5.6.380.0080.01114.51
5.6.370.0030.01314.55
5.6.360.0100.00714.75
5.6.350.0040.00814.70
5.6.340.0110.00614.58
5.6.330.0040.01314.40
5.6.320.0110.00514.57
5.6.310.0060.00813.88
5.6.300.0080.00814.59
5.6.290.0120.00614.04
5.6.280.0050.04117.68
5.6.270.0000.01814.30
5.6.260.0060.01014.25
5.6.250.0110.00714.30
5.6.240.0130.00614.44
5.6.230.0070.01314.23
5.6.220.0070.00714.38
5.6.210.0110.04617.67
5.6.200.0110.04216.23
5.6.190.0090.04517.53
5.6.180.1670.02517.64
5.6.170.0100.03317.33
5.6.160.0110.02417.39
5.6.150.0090.02316.24
5.6.140.0080.04116.35
5.6.130.0080.03816.30
5.6.120.0060.04917.70
5.6.110.0100.02417.87
5.6.100.0090.04517.75
5.6.90.0100.04817.65
5.6.80.0120.03717.21
5.6.70.1520.02417.42
5.6.60.0170.00314.61
5.6.50.0170.00314.15
5.6.40.0140.00514.42
5.6.30.0090.00614.41
5.6.20.0030.01314.42
5.6.10.0130.00414.57
5.6.00.0040.01314.29
5.5.380.0070.00411.12
5.5.370.0100.00310.81
5.5.360.0110.00611.34
5.5.350.0190.03615.86
5.5.340.0100.04414.80
5.5.330.0130.04115.82
5.5.320.0240.03015.92
5.5.310.0200.04415.73
5.5.300.0120.04214.53
5.5.290.0110.03214.69
5.5.280.0110.04316.05
5.5.270.0090.03216.04
5.5.260.0130.03816.14
5.5.250.0150.03815.93
5.5.240.0170.03615.76
5.5.230.0050.01011.46
5.5.220.0120.00411.14
5.5.210.0090.00911.36
5.5.200.0080.00811.07
5.5.190.0090.00010.98
5.5.180.0040.00411.14
5.5.170.0030.00911.26
5.5.160.0090.00311.27
5.5.150.0050.00510.94
5.5.140.0080.00411.09
5.5.130.0070.00711.34
5.5.120.0080.00311.43
5.5.110.0000.01011.07
5.5.100.0000.01010.62
5.5.90.0070.00211.21
5.5.80.0050.00811.30
5.5.70.0090.00011.09
5.5.60.0110.00011.51
5.5.50.0030.00710.86
5.5.40.0070.00411.38
5.5.30.0030.00611.27
5.5.20.0050.00511.20
5.5.10.0090.00011.41
5.5.00.0060.00610.88
5.4.450.0520.02915.38
5.4.440.0420.02515.24
5.4.430.0090.03815.44
5.4.420.0270.03215.29
5.4.410.0340.02815.18
5.4.400.0240.03015.17
5.4.390.0030.03115.16
5.4.380.0200.03014.74
5.4.370.0180.02814.91
5.4.360.0410.02414.89
5.4.350.0250.03014.75
5.4.340.0180.03314.89
5.4.330.0040.00710.95
5.4.320.0070.02611.83
5.4.310.0050.02611.77
5.4.300.0020.02411.71
5.4.290.0010.02711.84
5.4.280.0060.02111.67
5.4.270.0050.02311.76
5.4.260.0070.02011.74
5.4.250.0030.02411.79
5.4.240.0070.02011.67
5.4.230.0050.02311.57
5.4.220.0040.02011.65
5.4.210.0050.02111.81
5.4.200.0070.02011.79
5.4.190.0060.02211.69
5.4.180.0050.02111.81
5.4.170.0060.02211.87
5.4.160.0070.01811.64
5.4.150.0050.02111.75
5.4.140.0060.02011.67
5.4.130.0080.01911.59
5.4.120.0090.01811.44
5.4.110.0070.02011.51
5.4.100.0040.02111.61
5.4.90.0070.02011.62
5.4.80.0090.01711.60
5.4.70.0050.02311.50
5.4.60.0070.02111.49
5.4.50.0050.02611.67
5.4.40.0100.02211.57
5.4.30.0070.02311.69
5.4.20.0030.02211.37
5.4.10.0040.02711.63
5.4.00.0050.02911.43
5.3.290.0030.02411.89
5.3.280.0020.02511.74
5.3.270.0090.02211.79
5.3.260.0050.02511.67
5.3.250.0090.01911.80
5.3.240.0040.02511.75
5.3.230.0060.02211.73
5.3.220.0070.03011.67
5.3.210.0100.02211.67
5.3.200.0050.02111.65
5.3.190.0090.02011.65
5.3.180.0040.02411.63
5.3.170.0050.02411.76
5.3.160.0040.02411.72
5.3.150.0040.02111.63
5.3.140.0070.02111.76
5.3.130.0050.02411.72
5.3.120.0070.02611.56
5.3.110.0080.02611.56
5.3.100.0050.02111.37
5.3.90.0040.02111.49
5.3.80.0050.02211.29
5.3.70.0050.02611.41
5.3.60.0090.01911.47
5.3.50.0060.02211.34
5.3.40.0080.01911.41
5.3.30.0030.02511.48
5.3.20.0040.02311.35
5.3.10.0070.01911.08
5.3.00.0070.02111.14
5.2.170.0020.0209.61
5.2.160.0040.0179.60
5.2.150.0050.0189.61
5.2.140.0070.0169.60
5.2.130.0040.0189.58
5.2.120.0050.0189.58
5.2.110.0020.0199.59
5.2.100.0010.0209.58
5.2.90.0030.0179.59
5.2.80.0040.0179.58
5.2.70.0040.0179.58
5.2.60.0060.0189.56
5.2.50.0060.0229.54
5.2.40.0050.0199.53
5.2.30.0030.0199.52
5.2.20.0020.0189.51
5.2.10.0070.0209.47
5.2.00.0030.0189.40
5.1.60.0050.0149.03
5.1.50.0030.0159.03
5.1.40.0060.0119.02
5.1.30.0060.0169.20
5.1.20.0080.0199.21
5.1.10.0040.0179.07
5.1.00.0020.0169.07
5.0.50.0020.0168.31
5.0.40.0010.0148.24
5.0.30.0050.0158.15
5.0.20.0030.0128.13
5.0.10.0040.0158.12
5.0.00.0020.0228.12
4.4.90.0030.0127.37
4.4.80.0020.0127.36
4.4.70.0020.0107.36
4.4.60.0010.0107.36
4.4.50.0040.0087.37
4.4.40.0020.0157.33
4.4.30.0020.0177.36
4.4.20.0030.0127.40
4.4.10.0030.0127.40
4.4.00.0040.0157.36
4.3.110.0030.0097.31
4.3.100.0030.0107.31
4.3.90.0020.0077.30
4.3.80.0010.0167.27
4.3.70.0010.0117.29
4.3.60.0030.0097.29
4.3.50.0040.0107.29
4.3.40.0030.0177.24
4.3.30.0040.0076.63
4.3.20.0020.0096.62
4.3.10.0040.0076.60
4.3.00.0080.0168.51

preferences:
36.69 ms | 401 KiB | 5 Q