3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar = 'baz'; } function &reader ($object, $property) { $value = & Closure::bind(function & () use ($property) { return $this->$property; }, $object, $object)->__invoke(); return $value; }; $foo = new Foo(); $bar = & reader($foo, 'bar'); $bar = 'tab'; var_dump($foo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/la5ZE
function name:  (null)
number of ops:  13
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   16     3        INIT_FCALL                                               'reader'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 'bar'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN_REF                                               !1, $5
   17     8        ASSIGN                                                   !1, 'tab'
   19     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

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

End of function reader

Function %00%7Bclosure%7D%2Fin%2Fla5ZE%3A8%240:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/la5ZE
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   BIND_STATIC                                              !0
    9     1        FETCH_THIS                                       $1      
          2        FETCH_OBJ_W                                      $2      $1, !0
          3      > RETURN_BY_REF                                            $2
   10     4*     > RETURN_BY_REF                                            null

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

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.03 ms | 1399 KiB | 16 Q