3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { public $t = 3; public function call($fun) { $b = $fun($p); } } class b { public $t = 5; public function test() { $p = 2; a::call(function()use($p){echo $this->t;}); } } $b = new b(); $b->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6aCkZ
function name:  (null)
number of ops:  6
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'b'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   17     3        INIT_METHOD_CALL                                         !0, 'test'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2F6aCkZ%3A13%240

Class a:
Function call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6aCkZ
function name:  call
number of ops:  6
compiled vars:  !0 = $fun, !1 = $b, !2 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_DYNAMIC_CALL                                        !0
          2        SEND_VAR_EX                                              !2
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
    7     5      > RETURN                                                   null

End of function call

End of class a.

Class b:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6aCkZ
function name:  test
number of ops:  7
compiled vars:  !0 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, 2
   13     1        INIT_STATIC_METHOD_CALL                                  'a', 'call'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F6aCkZ%3A13%240'
          3        BIND_LEXICAL                                             ~2, !0
          4        SEND_VAL                                                 ~2
          5        DO_FCALL                                      0          
   14     6      > RETURN                                                   null

End of function test

End of class b.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.24 ms | 1395 KiB | 13 Q