3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { function __construct($fun) { $fun(); } function callMe() { echo "yay\n"; } static function create($fun) { return new X($fun); } } $x = X::create(function() use ($x) { $x->callMe(); });
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uvLJK
function name:  (null)
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_STATIC_METHOD_CALL                                  'X', 'create'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FuvLJK%3A8%240'
          2        BIND_LEXICAL                                             ~1, !0
          3        SEND_VAL                                                 ~1
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
          6      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FuvLJK%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uvLJK
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   BIND_STATIC                                              !0
          1        INIT_METHOD_CALL                                         !0, 'callMe'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FuvLJK%3A8%240

Class X:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uvLJK
function name:  __construct
number of ops:  4
compiled vars:  !0 = $fun
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        INIT_DYNAMIC_CALL                                        !0
          2        DO_FCALL                                      0          
          3      > RETURN                                                   null

End of function __construct

Function callme:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uvLJK
function name:  callMe
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'yay%0A'
          1      > RETURN                                                   null

End of function callme

Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uvLJK
function name:  create
number of ops:  6
compiled vars:  !0 = $fun
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        NEW                                              $1      'X'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of function create

End of class X.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.81 ms | 1395 KiB | 13 Q