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], PREG_OFFSET_CAPTURE, 0); preg_match($regex, $year, $matches[1], PREG_OFFSET_CAPTURE, 0); print_r($matches); ?>
Output for 4.3.3 - 7.1.0
Array ( [0] => Array ( [0] => Array ( [0] => 2008-2013 [1] => 0 ) [1] => Array ( [0] => 2008-2013 [1] => 0 ) ) [1] => Array ( [0] => Array ( [0] => 2008 [1] => 0 ) [1] => Array ( [0] => 2008 [1] => 0 ) ) )
Output for 4.3.0 - 4.3.2
Warning: Wrong parameter count for preg_match() in /in/KVkIt on line 9 Warning: Wrong parameter count for preg_match() in /in/KVkIt on line 10 Array ( [0] => Array ( ) [1] => )