3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar; } $friend = null; $foo = new Foo(); Closure::bind(function (Foo $foo) use (& $friend) { $friend = & $foo->bar; }, null, 'Foo')->__invoke($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/qEgae
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        NEW                                              $3      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   10     4        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FqEgae%3A10%240'
          6        BIND_LEXICAL                                             ~6, !0
   12     7        SEND_VAL                                                 ~6
          8        SEND_VAL                                                 null
          9        SEND_VAL                                                 'Foo'
         10        DO_FCALL                                      0  $7      
         11        INIT_METHOD_CALL                                         $7, '__invoke'
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
   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%2FqEgae%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qEgae
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $foo, !1 = $friend
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   11     2        FETCH_OBJ_W                                      $2      !0, 'bar'
          3        ASSIGN_REF                                               !1, $2
   12     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FqEgae%3A10%240

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.13 ms | 1396 KiB | 15 Q