3v4l.org

run code in 500+ PHP versions simultaneously
<?php $starting = 0; $arrayOfNumbersToSkip = [1, 3, 4, 5, 6]; $ending = 7; $availableNumbers = array_diff(range($starting+1, $ending), $arrayOfNumbersToSkip); if (!count($availableNumbers)) { echo "no numbers available\n"; } else { echo "first number available = " . array_shift($availableNumbers); } print_r($availableNumbers);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/li5bU
function name:  (null)
number of ops:  27
compiled vars:  !0 = $starting, !1 = $arrayOfNumbersToSkip, !2 = $ending, !3 = $availableNumbers
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 0
    4     1        ASSIGN                                                       !1, <array>
    5     2        ASSIGN                                                       !2, 7
    7     3        INIT_FCALL                                                   'array_diff'
          4        INIT_FCALL                                                   'range'
          5        ADD                                                  ~7      !0, 1
          6        SEND_VAL                                                     ~7
          7        SEND_VAR                                                     !2
          8        DO_ICALL                                             $8      
          9        SEND_VAR                                                     $8
         10        SEND_VAR                                                     !1
         11        DO_ICALL                                             $9      
         12        ASSIGN                                                       !3, $9
    8    13        COUNT                                                ~11     !3
         14        BOOL_NOT                                             ~12     ~11
         15      > JMPZ                                                         ~12, ->18
    9    16    >   ECHO                                                         'no+numbers+available%0A'
    8    17      > JMP                                                          ->23
   12    18    >   INIT_FCALL                                                   'array_shift'
         19        SEND_REF                                                     !3
         20        DO_ICALL                                             $13     
         21        CONCAT                                               ~14     'first+number+available+%3D+', $13
         22        ECHO                                                         ~14
   14    23    >   INIT_FCALL                                                   'print_r'
         24        SEND_VAR                                                     !3
         25        DO_ICALL                                                     
         26      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174.01 ms | 2100 KiB | 17 Q