3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generateNumbers() { $numbers = []; while ( count($numbers) < 7 ) { $number = rand(1,35); if ( !in_array($number, $numbers) ) { $numbers[] = $number; } } sort($numbers); return $numbers; } $numbers = generateNumbers(); $new = generateNumbers(); $counter = 1; while ( !empty(array_diff($numbers, $new)) ) { while ( in_array(implode(',',$new),$allNewNumbers) ) { $new = generateNumbers(); } $allNewNumbers[] = implode(',',$new); $counter++; echo 'counter: '.$counter.PHP_EOL; if ( $counter > 1000 ) { echo 'break'.PHP_EOL; break; } }
Output for 8.4.1 - 8.4.11
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.24
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,10,22,24,25,2...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.23
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,6,8,12,15,27,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.22
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,3,9,10,12,17,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.21
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('7,12,17,20,29,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.20
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,9,19,21,23,25...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.19
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,6,8,14,16,20,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.18
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,3,5,11,15,23,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.17
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,2,11,15,20,29...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.16
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,18,22,28,29,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.15
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('13,14,15,18,21,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.14
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('8,10,13,16,19,2...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.13
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,4,7,16,27,30,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.12
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,6,8,12,15,18,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.11
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,7,12,22,24,33...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.10
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,3,9,12,18,24,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.9
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('4,9,13,15,16,17...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.8
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,13,23,24,29,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.7
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('7,10,12,13,14,1...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.6
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,3,4,9,21,25,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.5
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,2,9,17,29,33,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.4
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,17,18,23,27,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.3
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,4,10,11,12,17...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.2
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('6,13,16,18,22,2...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.1
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,7,12,25,28,32...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.3.0
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('6,10,15,25,28,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.29
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,6,22,24,31,32...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.28
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('4,7,9,16,19,25,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.27
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('4,5,16,19,22,27...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.26
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('5,8,22,30,32,33...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.25
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,4,15,16,18,19...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.24
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,7,8,9,18,23,2...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.23
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('3,11,16,21,25,2...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.22
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('10,21,22,25,31,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.21
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('10,11,12,14,29,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.20
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,4,5,11,12,23,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.19
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('7,8,9,11,18,19,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.18
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,11,12,13,17,2...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.17
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('4,10,12,15,18,2...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.16
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('6,18,19,23,26,2...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.15
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('4,15,22,23,29,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.14
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('11,13,16,20,26,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.13
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('3,7,12,13,20,31...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.12
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('3,6,12,14,17,21...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.11
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('5,6,8,14,22,23,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.10
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('7,10,18,21,29,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.9
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('11,16,17,19,21,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.8
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('7,12,15,20,27,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.7
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('3,10,21,25,28,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.6
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('1,2,10,17,23,27...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.5
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('9,11,12,28,31,3...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.4
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('3,6,21,23,24,28...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.3
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('13,15,27,29,30,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.2
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,8,19,21,26,30...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.1
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('2,5,8,10,17,23,...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.
Output for 8.2.0
Warning: Undefined variable $allNewNumbers in /in/JWFnB on line 17 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/JWFnB:17 Stack trace: #0 /in/JWFnB(17): in_array('3,4,15,16,18,25...', NULL) #1 {main} thrown in /in/JWFnB on line 17
Process exited with code 255.

preferences:
44.22 ms | 496 KiB | 5 Q