3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isAvailable($date){ return ! in_array($date, [3, 4, 5, 10, 11, 12, 23, 24, 25, 26]); } $a = array(); $consecutively = []; $l = 0; for($i = 1; $i <= 30; $i++) { $isAvailable = isAvailable($i); $a[$i] = ['isAvailable' => $isAvailable]; if($isAvailable) { if( isset($consecutively[$l]) ) { $consecutively[$l]++; } else { $consecutively[$l] = 1; } $a[$i]['consecutively'] = &$consecutively[$l]; } else { $l++; } } print_r($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 5
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 26
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 5
Branch analysis from position: 30
Branch analysis from position: 5
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 5
Branch analysis from position: 30
Branch analysis from position: 5
filename:       /in/cVUkZ
function name:  (null)
number of ops:  34
compiled vars:  !0 = $a, !1 = $consecutively, !2 = $l, !3 = $i, !4 = $isAvailable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, <array>
    7     1        ASSIGN                                                   !1, <array>
    8     2        ASSIGN                                                   !2, 0
    9     3        ASSIGN                                                   !3, 1
          4      > JMP                                                      ->28
   11     5    >   INIT_FCALL                                               'isavailable'
          6        SEND_VAR                                                 !3
          7        DO_FCALL                                      0  $9      
          8        ASSIGN                                                   !4, $9
   12     9        INIT_ARRAY                                       ~12     !4, 'isAvailable'
         10        ASSIGN_DIM                                               !0, !3
         11        OP_DATA                                                  ~12
   13    12      > JMPZ                                                     !4, ->26
   15    13    >   ISSET_ISEMPTY_DIM_OBJ                         0          !1, !2
         14      > JMPZ                                                     ~13, ->18
   17    15    >   FETCH_DIM_RW                                     $14     !1, !2
         16        PRE_INC                                                  $14
         17      > JMP                                                      ->20
   21    18    >   ASSIGN_DIM                                               !1, !2
         19        OP_DATA                                                  1
   23    20    >   FETCH_DIM_W                                      $19     !1, !2
         21        MAKE_REF                                         $20     $19
         22        FETCH_DIM_W                                      $17     !0, !3
         23        FETCH_DIM_W                                      $18     $17, 'consecutively'
         24        ASSIGN_REF                                               $18, $20
         25      > JMP                                                      ->27
   27    26    >   PRE_INC                                                  !2
    9    27    >   PRE_INC                                                  !3
         28    >   IS_SMALLER_OR_EQUAL                                      !3, 30
         29      > JMPNZ                                                    ~24, ->5
   30    30    >   INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Function isavailable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cVUkZ
function name:  isAvailable
number of ops:  8
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'in_array'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <array>
          4        DO_ICALL                                         $1      
          5        BOOL_NOT                                         ~2      $1
          6      > RETURN                                                   ~2
    4     7*     > RETURN                                                   null

End of function isavailable

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.97 ms | 1403 KiB | 18 Q