3v4l.org

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

Function %00%7Bclosure%7D%2Fin%2F7ZVqN%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7ZVqN
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               !0, 'property'
          2        OP_DATA                                                  'world'
    9     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F7ZVqN%3A7%240

Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155 ms | 1387 KiB | 15 Q