3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar; } $friend = null; Closure::bind(function (Foo $foo) use (& $friend) { $friend = & $foo->bar; }, null, 'Foo')->__invoke($foo); $foo = new Foo(); var_dump($foo); $friend = 'baz'; var_dump($foo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CL5Hv
function name:  (null)
number of ops:  22
compiled vars:  !0 = $friend, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, null
    8     1        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FCL5Hv%3A8%240'
          3        BIND_LEXICAL                                             ~3, !0
   10     4        SEND_VAL                                                 ~3
          5        SEND_VAL                                                 null
          6        SEND_VAL                                                 'Foo'
          7        DO_FCALL                                      0  $4      
          8        INIT_METHOD_CALL                                         $4, '__invoke'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
   12    11        NEW                                              $6      'Foo'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !1, $6
   14    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                                 
   16    17        ASSIGN                                                   !0, 'baz'
   18    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FCL5Hv%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CL5Hv
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $foo, !1 = $friend
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    9     2        FETCH_OBJ_W                                      $2      !0, 'bar'
          3        ASSIGN_REF                                               !1, $2
   10     4      > RETURN                                                   null

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

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.16 ms | 1401 KiB | 15 Q