3v4l.org

run code in 300+ PHP versions simultaneously
<?php function call($o, $a, $r, $context) { return call_user_func_array($o, $a); } class A { protected $a = 5; public function __invoke() { $f = function () { return $this->a; }; return call($f, array(), array(), isset($this) ? $this : null); } } $a = new A; var_dump($a());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PHDI9
function name:  (null)
number of ops:  9
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        INIT_FCALL                                               'var_dump'
          4        INIT_DYNAMIC_CALL                                        !0
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PHDI9
function name:  call
number of ops:  10
compiled vars:  !0 = $o, !1 = $a, !2 = $r, !3 = $context
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    4     4        INIT_USER_CALL                                0          'call_user_func_array', !0
          5        SEND_ARRAY                                               !1
          6        CHECK_UNDEF_ARGS                                         
          7        DO_FCALL                                      0  $4      
          8      > RETURN                                                   $4
    5     9*     > RETURN                                                   null

End of function call

Function %00%7Bclosure%7D%2Fin%2FPHDI9%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PHDI9
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_THIS                                       $0      
          1        FETCH_OBJ_R                                      ~1      $0, 'a'
          2      > RETURN                                                   ~1
   14     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FPHDI9%3A12%240

Class A:
Function __invoke:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PHDI9
function name:  __invoke
number of ops:  16
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPHDI9%3A12%240'
          1        ASSIGN                                                   !0, ~1
   15     2        INIT_FCALL                                               'call'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <array>
          5        SEND_VAL                                                 <array>
          6        ISSET_ISEMPTY_THIS                               ~3      
          7      > JMPZ                                                     ~3, ->11
          8    >   FETCH_THIS                                       ~4      
          9        QM_ASSIGN                                        ~5      ~4
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~5      null
         12    >   SEND_VAL                                                 ~5
         13        DO_FCALL                                      0  $6      
         14      > RETURN                                                   $6
   16    15*     > RETURN                                                   null

End of function __invoke

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.02 ms | 1403 KiB | 16 Q