3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Kitchen { private $yummy = 'cake'; } $sweetsThief = function & (Kitchen $kitchen) { return $kitchen->yummy; }; $kitchen = new Kitchen(); $sweetsThief = Closure::bind($sweetsThief, null, $kitchen); $cake = & $sweetsThief($kitchen); $cake = 'lie'; var_dump('the cake is a ' . $sweetsThief($kitchen));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l6j8P
function name:  (null)
number of ops:  24
compiled vars:  !0 = $sweetsThief, !1 = $kitchen, !2 = $cake
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          1        ASSIGN                                                   !0, ~3
   12     2        NEW                                              $5      'Kitchen'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   14     5        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 null
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !0, $8
   17    11        INIT_DYNAMIC_CALL                                        !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0  $10     
         14        ASSIGN_REF                                               !2, $10
   19    15        ASSIGN                                                   !2, 'lie'
   21    16        INIT_FCALL                                               'var_dump'
         17        INIT_DYNAMIC_CALL                                        !0
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0  $13     
         20        CONCAT                                           ~14     'the+cake+is+a+', $13
         21        SEND_VAL                                                 ~14
         22        DO_ICALL                                                 
         23      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/l6j8P
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $kitchen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        FETCH_OBJ_W                                      $1      !0, 'yummy'
          2      > RETURN_BY_REF                                            $1
   10     3*     > RETURN_BY_REF                                            null

End of Dynamic Function 0

Class Kitchen: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.41 ms | 1437 KiB | 14 Q