3v4l.org

run code in 300+ PHP versions simultaneously
<?php class E{function r($e, $l){$this->e[$e][] = $l;} function d($e){foreach ($this->e[$e] as $l){$l->o();}}} class Listener { function o() { echo 'hello'; } } $listener = new Listener(); $eventDispatcher = new E(); $eventDispatcher->r('event1', $listener); $eventDispatcher->r('event1', $listener); $eventDispatcher->r('event2', $listener); $eventDispatcher->d('event1');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ma9hZ
function name:  (null)
number of ops:  22
compiled vars:  !0 = $listener, !1 = $eventDispatcher
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $2      'Listener'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   13     3        NEW                                              $5      'E'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   14     6        INIT_METHOD_CALL                                         !1, 'r'
          7        SEND_VAL_EX                                              'event1'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
   15    10        INIT_METHOD_CALL                                         !1, 'r'
         11        SEND_VAL_EX                                              'event1'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
   16    14        INIT_METHOD_CALL                                         !1, 'r'
         15        SEND_VAL_EX                                              'event2'
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0          
   18    18        INIT_METHOD_CALL                                         !1, 'd'
         19        SEND_VAL_EX                                              'event1'
         20        DO_FCALL                                      0          
         21      > RETURN                                                   1

Class E:
Function r:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ma9hZ
function name:  r
number of ops:  7
compiled vars:  !0 = $e, !1 = $l
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        FETCH_OBJ_W                                      $2      'e'
          3        FETCH_DIM_W                                      $3      $2, !0
          4        ASSIGN_DIM                                               $3
          5        OP_DATA                                                  !1
          6      > RETURN                                                   null

End of function r

Function d:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/ma9hZ
function name:  d
number of ops:  10
compiled vars:  !0 = $e, !1 = $l
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV                                             !0      
          1        FETCH_OBJ_R                                      ~2      'e'
          2        FETCH_DIM_R                                      ~3      ~2, !0
          3      > FE_RESET_R                                       $4      ~3, ->8
          4    > > FE_FETCH_R                                               $4, !1, ->8
          5    >   INIT_METHOD_CALL                                         !1, 'o'
          6        DO_FCALL                                      0          
          7      > JMP                                                      ->4
          8    >   FE_FREE                                                  $4
          9      > RETURN                                                   null

End of function d

End of class E.

Class Listener:
Function o:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ma9hZ
function name:  o
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'hello'
    9     1      > RETURN                                                   null

End of function o

End of class Listener.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.6 ms | 1399 KiB | 13 Q