3v4l.org

run code in 300+ PHP versions simultaneously
<?php $zakres_valid = '@^ST-[0-9]{5,8}$@'; $zakres = array(); $st = 'ST-856549'; for($i=0;$i<10;$i++){ $zakres[] = $st; $st++; } var_dump($zakres); for($i=0;$i<10;$i++){ if(!preg_match($zakres_valid, $zakres[$i])){ echo "/".$zakres_valid.", ".$zakres."/"; echo "ERROR. Numer $zakres[$i] z podanego zakresu nie pasuje do wzorca.<br />"; } else { echo "OK"; } } ?>
Output for 8.3.0 - 8.3.6
Deprecated: Increment on non-alphanumeric string is deprecated in /in/pVXPJ on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/pVXPJ on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/pVXPJ on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/pVXPJ on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/pVXPJ on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/pVXPJ on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/pVXPJ on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/pVXPJ on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/pVXPJ on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/pVXPJ on line 9 array(10) { [0]=> string(9) "ST-856549" [1]=> string(9) "ST-856550" [2]=> string(9) "ST-856551" [3]=> string(9) "ST-856552" [4]=> string(9) "ST-856553" [5]=> string(9) "ST-856554" [6]=> string(9) "ST-856555" [7]=> string(9) "ST-856556" [8]=> string(9) "ST-856557" [9]=> string(9) "ST-856558" } OKOKOKOKOKOKOKOKOKOK
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.17 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
array(10) { [0]=> string(9) "ST-856549" [1]=> string(9) "ST-856550" [2]=> string(9) "ST-856551" [3]=> string(9) "ST-856552" [4]=> string(9) "ST-856553" [5]=> string(9) "ST-856554" [6]=> string(9) "ST-856555" [7]=> string(9) "ST-856556" [8]=> string(9) "ST-856557" [9]=> string(9) "ST-856558" } OKOKOKOKOKOKOKOKOKOK

preferences:
247.84 ms | 406 KiB | 339 Q