3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Mediator { protected $events = array(); public function attach($eventName, $callback) { if (!isset($this->events[$eventName])) { $this->events[$eventName] = array(); } $this->events[$eventName][] = $callback; } public function trigger($eventName, $data = null) { foreach ($this->events[$eventName] as $callback) { $callback($eventName, $data); } } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UCqqr
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E > > RETURN                                                   1

Class Mediator:
Function attach:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/UCqqr
function name:  attach
number of ops:  14
compiled vars:  !0 = $eventName, !1 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        FETCH_OBJ_IS                                     ~2      'events'
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      ~2, !0
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->9
    7     6    >   FETCH_OBJ_W                                      $5      'events'
          7        ASSIGN_DIM                                               $5, !0
          8        OP_DATA                                                  <array>
    9     9    >   FETCH_OBJ_W                                      $7      'events'
         10        FETCH_DIM_W                                      $8      $7, !0
         11        ASSIGN_DIM                                               $8
         12        OP_DATA                                                  !1
   10    13      > RETURN                                                   null

End of function attach

Function trigger:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/UCqqr
function name:  trigger
number of ops:  13
compiled vars:  !0 = $eventName, !1 = $data, !2 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   12     2        FETCH_OBJ_R                                      ~3      'events'
          3        FETCH_DIM_R                                      ~4      ~3, !0
          4      > FE_RESET_R                                       $5      ~4, ->11
          5    > > FE_FETCH_R                                               $5, !2, ->11
   13     6    >   INIT_DYNAMIC_CALL                                        !2
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
   12    10      > JMP                                                      ->5
         11    >   FE_FREE                                                  $5
   15    12      > RETURN                                                   null

End of function trigger

End of class Mediator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.49 ms | 1395 KiB | 13 Q