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 = null; $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/o6q4N
function name:  (null)
number of ops:  8
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, null
    9     1        INIT_STATIC_METHOD_CALL                                  'X', 'create'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fo6q4N%3A9%240'
          3        BIND_LEXICAL                                             ~2, !0
          4        SEND_VAL                                                 ~2
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !0, $3
          7      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fo6q4N%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o6q4N
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%2Fo6q4N%3A9%240

Class X:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o6q4N
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/o6q4N
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/o6q4N
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:
179.44 ms | 1395 KiB | 13 Q