3v4l.org

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

Function %00%7Bclosure%7D%2Fin%2FZbu7E%3A22%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zbu7E
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FZbu7E%3A22%241

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/Zbu7E
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      
    6     1        INSTANCEOF                                               !0, 'ListenerAggregate'
          2      > JMPZ                                                     ~1, ->5
    8     3    >   ECHO                                                     'Attached+aggregate'
          4      > JMP                                                      ->6
   10     5    >   ECHO                                                     'Attached+regular+callable'
   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/Zbu7E
function name:  __invoke
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E > > RETURN                                                   null

End of function __invoke

End of class SomeAggregateListener.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.52 ms | 1399 KiB | 13 Q