3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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();
based on ll6cK
Output for 7.2.0
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 5.3.20 - 7.1.10
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 }