3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static function F() { return "A"; } } $c = (function() { var_dump(static::F()); })->bindTo(new A, NULL); var_dump((new \ReflectionFunction($c))->getClosureScopeClass()->name); $c(); $c = (function() { var_dump(self::F()); })->bindTo(new A, "A"); var_dump((new \ReflectionFunction($c))->getClosureScopeClass()->name); $c(); $c = (function() { var_dump(self::F()); })->bindTo(new A, NULL); var_dump((new \ReflectionFunction($c))->getClosureScopeClass()->name); $c();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SuAuh
function name:  (null)
number of ops:  58
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                          ~1      [0]
          1        INIT_METHOD_CALL                                         ~1, 'bindTo'
          2        NEW                                              $2      'A'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $2
          5        SEND_VAL_EX                                              null
          6        DO_FCALL                                      0  $4      
          7        ASSIGN                                                   !0, $4
    6     8        INIT_FCALL                                               'var_dump'
          9        NEW                                              $6      'ReflectionFunction'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0          
         12        INIT_METHOD_CALL                                         $6, 'getClosureScopeClass'
         13        DO_FCALL                                      0  $8      
         14        FETCH_OBJ_R                                      ~9      $8, 'name'
         15        SEND_VAL                                                 ~9
         16        DO_ICALL                                                 
    7    17        INIT_DYNAMIC_CALL                                        !0
         18        DO_FCALL                                      0          
    9    19        DECLARE_LAMBDA_FUNCTION                          ~12     [1]
         20        INIT_METHOD_CALL                                         ~12, 'bindTo'
         21        NEW                                              $13     'A'
         22        DO_FCALL                                      0          
         23        SEND_VAR_NO_REF_EX                                       $13
         24        SEND_VAL_EX                                              'A'
         25        DO_FCALL                                      0  $15     
         26        ASSIGN                                                   !0, $15
   10    27        INIT_FCALL                                               'var_dump'
         28        NEW                                              $17     'ReflectionFunction'
         29        SEND_VAR_EX                                              !0
         30        DO_FCALL                                      0          
         31        INIT_METHOD_CALL                                         $17, 'getClosureScopeClass'
         32        DO_FCALL                                      0  $19     
         33        FETCH_OBJ_R                                      ~20     $19, 'name'
         34        SEND_VAL                                                 ~20
         35        DO_ICALL                                                 
   11    36        INIT_DYNAMIC_CALL                                        !0
         37        DO_FCALL                                      0          
   13    38        DECLARE_LAMBDA_FUNCTION                          ~23     [2]
         39        INIT_METHOD_CALL                                         ~23, 'bindTo'
         40        NEW                                              $24     'A'
         41        DO_FCALL                                      0          
         42        SEND_VAR_NO_REF_EX                                       $24
         43        SEND_VAL_EX                                              null
         44        DO_FCALL                                      0  $26     
         45        ASSIGN                                                   !0, $26
   14    46        INIT_FCALL                                               'var_dump'
         47        NEW                                              $28     'ReflectionFunction'
         48        SEND_VAR_EX                                              !0
         49        DO_FCALL                                      0          
         50        INIT_METHOD_CALL                                         $28, 'getClosureScopeClass'
         51        DO_FCALL                                      0  $30     
         52        FETCH_OBJ_R                                      ~31     $30, 'name'
         53        SEND_VAL                                                 ~31
         54        DO_ICALL                                                 
   15    55        INIT_DYNAMIC_CALL                                        !0
         56        DO_FCALL                                      0          
         57      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SuAuh
function name:  {closure}
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'F'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
          5      > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SuAuh
function name:  {closure}
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'F'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
          5      > RETURN                                                   null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SuAuh
function name:  {closure}
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'F'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
          5      > RETURN                                                   null

End of Dynamic Function 2

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

End of function f

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.96 ms | 1019 KiB | 14 Q