3v4l.org

run code in 300+ PHP versions simultaneously
<?php $notifications = array(); function add($type){ global $notifications; $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/BvG48
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>
   32     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->10
   34     3    >   INIT_FCALL                                               'add'
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0          
   35     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   32     9        PRE_INC                                                  !1
         10    >   IS_SMALLER                                               !1, 2
         11      > JMPNZ                                                    ~7, ->3
   37    12    > > RETURN                                                   1

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

End of function add

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.22 ms | 1403 KiB | 20 Q