3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ClassLoader { private $classMap = 'Class Map'; } $loader = new ClassLoader; $func_without_closure_bind = function() use ($loader) { var_dump($loader->classMap); }; $func_with_closure_bind = Closure::bind($func_without_closure_bind, null, ClassLoader::class); $func_with_closure_bind(); //$func_without_closure_bind(); var_dump($laoder);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LXTap
function name:  (null)
number of ops:  18
compiled vars:  !0 = $loader, !1 = $func_without_closure_bind, !2 = $func_with_closure_bind, !3 = $laoder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $4      'ClassLoader'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    9     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLXTap%3A9%240'
          4        BIND_LEXICAL                                             ~7, !0
          5        ASSIGN                                                   !1, ~7
   13     6        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          7        SEND_VAR                                                 !1
          8        SEND_VAL                                                 null
          9        SEND_VAL                                                 'ClassLoader'
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !2, $9
   15    12        INIT_DYNAMIC_CALL                                        !2
         13        DO_FCALL                                      0          
   17    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FLXTap%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LXTap
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $loader
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   10     1        INIT_FCALL                                               'var_dump'
          2        FETCH_OBJ_R                                      ~1      !0, 'classMap'
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
   11     5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLXTap%3A9%240

Class ClassLoader: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.48 ms | 1395 KiB | 15 Q