3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $year = "2008"; $range = "2008-2013"; $regex = "/^(\d{0,4}+(?:-\d{0,4}+)?)$/is"; $matches = array(array()); preg_match($regex, $range, $matches[0], 1); preg_match($regex, $year, $matches[1], 1); print_r($matches); ?>
Output for 5.2.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: preg_match(): Invalid flags specified in /in/61bYa on line 9 Warning: preg_match(): Invalid flags specified in /in/61bYa on line 10 Array ( [0] => Array ( ) [1] => Array ( ) )
Output for hhvm-3.10.0 - 3.13.2
Warning: Invalid flags specified in /in/61bYa on line 9 Warning: Invalid flags specified in /in/61bYa on line 10 Array ( [0] => Array ( ) [1] => Array ( ) )
Output for 4.3.0 - 4.3.10, 5.0.0 - 5.1.6
Warning: Wrong value for parameter 4 in call to preg_match() in /in/61bYa on line 9 Warning: Wrong value for parameter 4 in call to preg_match() in /in/61bYa on line 10 Array ( [0] => Array ( ) [1] => )
Output for 4.3.11 - 4.4.9
Warning: preg_match(): Wrong value for parameter 4 in call to preg_match() in /in/61bYa on line 9 Warning: preg_match(): Wrong value for parameter 4 in call to preg_match() in /in/61bYa on line 10 Array ( [0] => Array ( ) [1] => )