3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Kitchen { private $yummy = 'cake'; } $reader = function & ($object, $property) { $value = & Closure::bind(function & () use ($property) { return $this->$property; }, $object, $object)->__invoke(); return $value; }; $kitchen = new Kitchen(); $cake = & $reader($kitchen, 'yummy'); $cake = 'sorry, I ate it!'; var_dump($kitchen);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QJfqf
function name:  (null)
number of ops:  15
compiled vars:  !0 = $reader, !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
   16     2        NEW                                              $5      'Kitchen'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   17     5        INIT_DYNAMIC_CALL                                        !0
          6        SEND_VAR_EX                                              !1
          7        SEND_VAL_EX                                              'yummy'
          8        DO_FCALL                                      0  $8      
          9        ASSIGN_REF                                               !2, $8
   18    10        ASSIGN                                                   !2, 'sorry%2C+I+ate+it%21'
   20    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
         14      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/QJfqf
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $object, !1 = $property, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          3        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          4        BIND_LEXICAL                                             ~3, !1
   11     5        SEND_VAL                                                 ~3
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !0
    9     8        DO_FCALL                                      0  $4      
   11     9        INIT_METHOD_CALL                                         $4, '__invoke'
         10        DO_FCALL                                      0  $5      
         11        ASSIGN_REF                                               !2, $5
   13    12      > RETURN_BY_REF                                            !2
   14    13*     > RETURN_BY_REF                                            null


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

End of Dynamic Function 0

End of Dynamic Function 0

Class Kitchen: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.79 ms | 1452 KiB | 14 Q