3v4l.org

run code in 300+ PHP versions simultaneously
<?php function giveGaps($a=array(9999,3), $k=4) { $gaps = array(); $cap = ''; for($j = 0; $j < $k; $j++) { $cap .= 9; } $cap = (int) $cap; for($i = 0; $i < sizeOf($a); $i++) { if( $a[$i+1] < $a[$i] ) { for($j = 0; $j <= ($a[$i+1])-1; $j++ ) { $gaps[j] = $cap%$cap; $cap++; } } else { /* wie sonst */ } } print "{ "; foreach( §gaps as $gap ) { print $gap . ", "; } print "}\n"; } giveGaps();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Undefined constant "j" in /in/YL46a:15 Stack trace: #0 /in/YL46a(21): giveGaps() #1 {main} thrown in /in/YL46a on line 15
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Undefined constant "j" in /in/YL46a:15 Stack trace: #0 /in/YL46a(21): giveGaps() #1 {main} thrown in /in/YL46a on line 15
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Warning: Use of undefined constant j - assumed 'j' (this will throw an Error in a future version of PHP) in /in/YL46a on line 15 Warning: Use of undefined constant j - assumed 'j' (this will throw an Error in a future version of PHP) in /in/YL46a on line 15 Warning: Use of undefined constant j - assumed 'j' (this will throw an Error in a future version of PHP) in /in/YL46a on line 15 Notice: Undefined offset: 2 in /in/YL46a on line 13 Notice: Undefined offset: 2 in /in/YL46a on line 14 { Warning: Use of undefined constant §gaps - assumed '§gaps' (this will throw an Error in a future version of PHP) in /in/YL46a on line 20 Warning: Invalid argument supplied for foreach() in /in/YL46a on line 20 }
Output for 7.3.32 - 7.3.33
Warning: Use of undefined constant j - assumed 'j' (this will throw an Error in a future version of PHP) in /in/YL46a on line 15 Warning: Use of undefined constant j - assumed 'j' (this will throw an Error in a future version of PHP) in /in/YL46a on line 15 Warning: Use of undefined constant j - assumed 'j' (this will throw an Error in a future version of PHP) in /in/YL46a on line 15 { Warning: Use of undefined constant §gaps - assumed '§gaps' (this will throw an Error in a future version of PHP) in /in/YL46a on line 20 Warning: Invalid argument supplied for foreach() in /in/YL46a on line 20 }
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Notice: Use of undefined constant j - assumed 'j' in /in/YL46a on line 15 Notice: Use of undefined constant j - assumed 'j' in /in/YL46a on line 15 Notice: Use of undefined constant j - assumed 'j' in /in/YL46a on line 15 Notice: Undefined offset: 2 in /in/YL46a on line 13 Notice: Undefined offset: 2 in /in/YL46a on line 14 { Notice: Use of undefined constant §gaps - assumed '§gaps' in /in/YL46a on line 20 Warning: Invalid argument supplied for foreach() in /in/YL46a on line 20 }

preferences:
183.26 ms | 403 KiB | 229 Q