3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '20140101'; function build($str){ $episodeId = intval($episodeId).''; $len = strlen($episodeId); if($len == 8 ){ $rows = str_split($episodeId, 2); $year = intval($rows[0].$rows[1]); if($year<1980 || $year > 2015){ throw new Base_Exception('episode_id invalid:'.$field, ERRNO_PARAM_ANALYZE); } if($row[2]<=0 || $row[2]>12 || $row[3]<=0 || $row[3]>31){ throw new Base_Exception('episode_id invalid:'.$field, ERRNO_PARAM_ANALYZE); } if(intval($episodeId)>= intval(date('Ymd')+1)){ throw new Base_Exception('episode_id invalid:'.$field, ERRNO_PARAM_ANALYZE); } return $episodeId; }elseif($len ==4){ $episodeId = intval($episodeId); if($episodeId<1980 || $episodeId > 2015){ throw new Base_Exception('episode_id invalid:'.$field, ERRNO_PARAM_ANALYZE); } return $episodeId.'0101'; } } } build($str);

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)
5.4.340.0030.03712.04
5.4.320.0050.03712.53
5.4.310.0030.04012.53
5.4.300.0060.03512.53
5.4.290.0110.03712.53
5.4.280.0060.04012.43
5.4.270.0030.03812.43
5.4.260.0070.03612.43
5.4.250.0060.03712.43
5.4.240.0040.03712.43
5.4.230.0090.03412.42
5.4.220.0070.03412.42
5.4.210.0070.03312.41
5.4.200.0030.03912.41
5.4.190.0030.03712.41
5.4.180.0060.03712.41
5.4.170.0060.03512.42
5.4.160.0040.04212.41
5.4.150.0060.03512.41
5.4.140.0090.04112.10
5.4.130.0050.03512.08
5.4.120.0090.03912.04
5.4.110.0040.03612.04
5.4.100.0080.03212.04
5.4.90.0020.03912.04
5.4.80.0030.03812.05
5.4.70.0090.03512.04
5.4.60.0070.03212.04
5.4.50.0040.03612.04
5.4.40.0070.03512.02
5.4.30.0060.03912.02
5.4.20.0050.03412.02
5.4.10.0050.03812.02
5.4.00.0070.03511.51
5.3.290.0050.03912.80
5.3.280.0070.03612.71
5.3.270.0050.03912.72
5.3.260.0050.03812.72
5.3.250.0080.03412.72
5.3.240.0020.04012.72
5.3.230.0090.03312.70
5.3.220.0060.03612.68
5.3.210.0040.03912.68
5.3.200.0050.03512.68
5.3.190.0100.03212.68
5.3.180.0040.03712.67
5.3.170.0040.03712.67
5.3.160.0080.03412.67
5.3.150.0050.03712.67
5.3.140.0090.03112.66
5.3.130.0030.04012.66
5.3.120.0050.04112.66
5.3.110.0080.04512.66
5.3.100.0060.04312.13
5.3.90.0060.03512.12
5.3.80.0100.03212.11
5.3.70.0070.03412.11
5.3.60.0040.03712.10
5.3.50.0020.03912.04
5.3.40.0060.03612.04
5.3.30.0050.03512.00
5.3.20.0060.03411.78
5.3.10.0020.03711.75
5.3.00.0070.04911.73
5.2.170.0020.0329.23
5.2.160.0030.0309.23
5.2.150.0040.0309.23
5.2.140.0040.0299.23
5.2.130.0050.0359.20
5.2.120.0060.0299.19
5.2.110.0040.0299.20
5.2.100.0060.0279.19
5.2.90.0050.0299.20
5.2.80.0050.0299.19
5.2.70.0040.0319.19
5.2.60.0070.0339.15
5.2.50.0060.0309.12
5.2.40.0040.0309.10
5.2.30.0110.0289.06
5.2.20.0040.0299.05
5.2.10.0060.0288.96
5.2.00.0050.0278.82
5.1.60.0040.0238.11
5.1.50.0030.0258.10
5.1.40.0020.0268.09
5.1.30.0050.0258.43
5.1.20.0030.0278.46
5.1.10.0030.0278.18
5.1.00.0050.0248.19
5.0.50.0030.0216.67
5.0.40.0030.0236.53
5.0.30.0020.0326.33
5.0.20.0030.0196.30
5.0.10.0000.0226.29
5.0.00.0040.0296.27
4.4.90.0050.0194.78
4.4.80.0030.0194.75
4.4.70.0020.0154.76
4.4.60.0040.0204.76
4.4.50.0030.0154.77
4.4.40.0040.0234.70
4.4.30.0010.0164.76
4.4.20.0020.0154.85
4.4.10.0020.0154.85
4.4.00.0040.0324.76
4.3.110.0020.0194.67
4.3.100.0040.0144.66
4.3.90.0030.0164.64
4.3.80.0010.0294.58
4.3.70.0020.0154.63
4.3.60.0040.0134.63
4.3.50.0020.0154.63
4.3.40.0020.0244.54
4.3.30.0010.0173.30
4.3.20.0010.0203.28
4.3.10.0030.0173.24
4.3.00.0170.0237.31

preferences:
144.9 ms | 1386 KiB | 7 Q