3v4l.org

run code in 300+ PHP versions simultaneously
<?php $zakres_valid = '/^[A-Za-z\/]{1,5}-[0-9]{5,8}$/'; $zakres = array(); $st = 'ST-856549'; for($i=0;$i<10;$i++){ $zakres[] = $st; $st++; } var_dump($zakres); 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"; } ?>
Output for 8.3.0 - 8.3.6
Deprecated: Increment on non-alphanumeric string is deprecated in /in/jhuao on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/jhuao on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/jhuao on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/jhuao on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/jhuao on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/jhuao on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/jhuao on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/jhuao on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/jhuao on line 9 Deprecated: Increment on non-alphanumeric string is deprecated in /in/jhuao 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" } Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /in/jhuao:12 Stack trace: #0 /in/jhuao(12): preg_match('/^[A-Za-z\\/]{1,...', Array) #1 {main} thrown in /in/jhuao on line 12
Process exited with code 255.
Output for 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" } Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /in/jhuao:12 Stack trace: #0 /in/jhuao(12): preg_match('/^[A-Za-z\\/]{1,...', Array) #1 {main} thrown in /in/jhuao on line 12
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
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" } Warning: preg_match() expects parameter 2 to be string, array given in /in/jhuao on line 12 Notice: Array to string conversion in /in/jhuao on line 13 //^[A-Za-z\/]{1,5}-[0-9]{5,8}$/, Array/ Notice: Undefined offset: 10 in /in/jhuao on line 14 ERROR. Numer z podanego zakresu nie pasuje do wzorca.<br />
Output for 7.3.32 - 7.3.33
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" } Warning: preg_match() expects parameter 2 to be string, array given in /in/jhuao on line 12 //^[A-Za-z\/]{1,5}-[0-9]{5,8}$/, Array/ERROR. Numer z podanego zakresu nie pasuje do wzorca.<br />
Output for 5.3.0 - 5.3.29
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" } Warning: preg_match() expects parameter 2 to be string, array given in /in/jhuao on line 12 //^[A-Za-z\/]{1,5}-[0-9]{5,8}$/, Array/ Notice: Undefined offset: 10 in /in/jhuao on line 14 ERROR. Numer z podanego zakresu nie pasuje do wzorca.<br />
Output for 4.3.3 - 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
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" } Warning: preg_match() expects parameter 2 to be string, array given in /in/jhuao on line 12 //^[A-Za-z\/]{1,5}-[0-9]{5,8}$/, Array/ Notice: Undefined offset: 10 in /in/jhuao on line 14 ERROR. Numer z podanego zakresu nie pasuje do wzorca.<br />
Output for 4.3.0 - 4.3.2
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" } Notice: Array to string conversion in /in/jhuao on line 12 //^[A-Za-z\/]{1,5}-[0-9]{5,8}$/, Array/ Notice: Undefined offset: 10 in /in/jhuao on line 14 ERROR. Numer z podanego zakresu nie pasuje do wzorca.<br />

preferences:
311.82 ms | 402 KiB | 422 Q