3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $zakres_valid = '/^[A-Za-z\/]{1,5}-[0-9]{5,8}$/'; $zakres = 'ST-12345 '; if(!preg_match($zakres_valid, $zakres)){ echo "/".$zakres_valid.", ".$zakres."/"; echo "ERROR. Numer $zakres[$i] z podanego zakresu nie pasuje do wzorca.<br />"; } else { echo "OK"; } ?>
based on YBfZB
Output for 5.4.5 - 7.1.0
//^[A-Za-z\/]{1,5}-[0-9]{5,8}$/, ST-12345 / Notice: Undefined variable: i in /in/1NHgD on line 7 Notice: String offset cast occurred in /in/1NHgD on line 7 ERROR. Numer S z podanego zakresu nie pasuje do wzorca.<br />
Output for 5.4.0 - 5.4.4
//^[A-Za-z\/]{1,5}-[0-9]{5,8}$/, ST-12345 / Notice: Undefined variable: i in /in/1NHgD on line 7 Notice: String offset cast occured in /in/1NHgD on line 7 ERROR. Numer S z podanego zakresu nie pasuje do wzorca.<br />
Output for 5.0.4 - 5.3.29
//^[A-Za-z\/]{1,5}-[0-9]{5,8}$/, ST-12345 / Notice: Undefined variable: i in /in/1NHgD on line 7 ERROR. Numer S z podanego zakresu nie pasuje do wzorca.<br />
Output for 4.3.0 - 5.0.3
//^[A-Za-z\/]{1,5}-[0-9]{5,8}$/, ST-12345 / Notice: Undefined variable: i in /in/1NHgD on line 7 ERROR. Numer S z podanego zakresu nie pasuje do wzorca.<br />