3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Mediator { var $events = array(); public function attach($eventName, $callback) { $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/XOYAZ
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E > > RETURN                                                   1

Class Mediator:
Function attach:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XOYAZ
function name:  attach
number of ops:  7
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_W                                      $2      'events'
          3        FETCH_DIM_W                                      $3      $2, !0
          4        ASSIGN_DIM                                               $3
          5        OP_DATA                                                  !1
    7     6      > 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/XOYAZ
function name:  trigger
number of ops:  13
compiled vars:  !0 = $eventName, !1 = $data, !2 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    9     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
   10     6    >   INIT_DYNAMIC_CALL                                        !2
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
    9    10      > JMP                                                      ->5
         11    >   FE_FREE                                                  $5
   12    12      > RETURN                                                   null

End of function trigger

End of class Mediator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.64 ms | 1395 KiB | 13 Q