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);
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.34
Parse error: syntax error, unexpected '}' in /in/ZueRh on line 28
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '}' in /in/ZueRh on line 28
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/ZueRh on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_NEW in /in/ZueRh on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ZueRh on line 10
Process exited with code 255.

preferences:
365.59 ms | 1395 KiB | 124 Q