3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ListenerAggregate {} class EM { public function attach($listener) { if($listener instanceof ListenerAggregate){ echo "Attached an aggregate\n"; }else{ echo "Attached regular callable\n"; } } } class SomeAggregateListener implements ListenerAggregate { public function __invoke() { // look ma, I'm a callable! } } $em = new EM; $aggregate = new SomeAggregateListener; $em->attach($aggregate);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VLDGL
function name:  (null)
number of ops:  11
compiled vars:  !0 = $em, !1 = $aggregate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_CLASS                                            'someaggregatelistener'
   22     1        NEW                                              $2      'EM'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   24     4        NEW                                              $5      'SomeAggregateListener'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   25     7        INIT_METHOD_CALL                                         !0, 'attach'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Class ListenerAggregate: [no user functions]
Class EM:
Function attach:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VLDGL
function name:  attach
number of ops:  7
compiled vars:  !0 = $listener
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INSTANCEOF                                               !0, 'ListenerAggregate'
          2      > JMPZ                                                     ~1, ->5
    8     3    >   ECHO                                                     'Attached+an+aggregate%0A'
          4      > JMP                                                      ->6
   10     5    >   ECHO                                                     'Attached+regular+callable%0A'
   12     6    > > RETURN                                                   null

End of function attach

End of class EM.

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

End of function __invoke

End of class SomeAggregateListener.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.75 ms | 1395 KiB | 13 Q