3v4l.org

run code in 300+ PHP versions simultaneously
<?php $notifications = array(); function add($type){ $notify = array( 'text' => '11' , 'link' => '22' ); if ( $notifications && count($notifications[$type]) <= 4 && count($notifications[$type]) ) { array_unshift($notifications[$type], $notify); } elseif ( $notifications && count($notifications[$type]) > 4 ) { array_pop($notifications[$type]); array_unshift($notifications[$type], $notify); } else { $notifications[$type] = []; array_unshift($notifications[$type], $notify); } } for($i = 0; $i< 2; $i++){ add($i); var_dump($notifications); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
Branch analysis from position: 3
filename:       /in/JUbOO
function name:  (null)
number of ops:  13
compiled vars:  !0 = $notifications, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   31     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->10
   33     3    >   INIT_FCALL                                               'add'
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0          
   34     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   31     9        PRE_INC                                                  !1
         10    >   IS_SMALLER                                               !1, 2
         11      > JMPNZ                                                    ~7, ->3
   36    12    > > RETURN                                                   1

Function add:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 34
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 11
Branch analysis from position: 7
filename:       /in/JUbOO
function name:  add
number of ops:  42
compiled vars:  !0 = $type, !1 = $notify, !2 = $notifications
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
   10     2      > JMPZ_EX                                          ~4      !2, ->7
          3    >   FETCH_DIM_R                                      ~5      !2, !0
          4        COUNT                                            ~6      ~5
          5        IS_SMALLER_OR_EQUAL                              ~7      ~6, 4
          6        BOOL                                             ~4      ~7
          7    > > JMPZ_EX                                          ~4      ~4, ->11
          8    >   FETCH_DIM_R                                      ~8      !2, !0
          9        COUNT                                            ~9      ~8
         10        BOOL                                             ~4      ~9
         11    > > JMPZ                                                     ~4, ->18
   12    12    >   INIT_FCALL                                               'array_unshift'
         13        FETCH_DIM_W                                      $10     !2, !0
         14        SEND_REF                                                 $10
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                                 
         17      > JMP                                                      ->41
   15    18    > > JMPZ_EX                                          ~12     !2, ->23
         19    >   FETCH_DIM_R                                      ~13     !2, !0
         20        COUNT                                            ~14     ~13
         21        IS_SMALLER                                       ~15     4, ~14
         22        BOOL                                             ~12     ~15
         23    > > JMPZ                                                     ~12, ->34
   17    24    >   INIT_FCALL                                               'array_pop'
         25        FETCH_DIM_W                                      $16     !2, !0
         26        SEND_REF                                                 $16
         27        DO_ICALL                                                 
   18    28        INIT_FCALL                                               'array_unshift'
         29        FETCH_DIM_W                                      $18     !2, !0
         30        SEND_REF                                                 $18
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                                 
         33      > JMP                                                      ->41
   23    34    >   ASSIGN_DIM                                               !2, !0
         35        OP_DATA                                                  <array>
   24    36        INIT_FCALL                                               'array_unshift'
         37        FETCH_DIM_W                                      $21     !2, !0
         38        SEND_REF                                                 $21
         39        SEND_VAR                                                 !1
         40        DO_ICALL                                                 
   29    41    > > RETURN                                                   null

End of function add

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.57 ms | 1403 KiB | 20 Q