3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar = 'baz'; private $br = 'baz'; private $ba = 'baz'; } $reader = function & ($object, $property) { $value = & Closure::bind(function & () { $l = []; foreach ($this as $name => $value) { $l[$name] = $value; } return $l; }, $object, $object)->__invoke(); return $value; }; $foo = new Foo(); $bar = & $reader($foo); var_dump($bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ec5fg
function name:  (null)
number of ops:  13
compiled vars:  !0 = $reader, !1 = $foo, !2 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fec5fg%3A10%240'
          1        ASSIGN                                                   !0, ~3
   22     2        NEW                                              $5      'Foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   23     5        INIT_DYNAMIC_CALL                                        !0
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $8      
          8        ASSIGN_REF                                               !2, $8
   25     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

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

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

Function %00%7Bclosure%7D%2Fin%2Fec5fg%3A11%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
Return found
Branch analysis from position: 8
filename:       /in/ec5fg
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $l, !1 = $value, !2 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   13     1        FETCH_THIS                                       ~4      
          2      > FE_RESET_R                                       $5      ~4, ->8
          3    > > FE_FETCH_R                                       ~6      $5, !1, ->8
          4    >   ASSIGN                                                   !2, ~6
   14     5        ASSIGN_DIM                                               !0, !2
          6        OP_DATA                                                  !1
   13     7      > JMP                                                      ->3
          8    >   FE_FREE                                                  $5
   16     9      > RETURN_BY_REF                                            !0
   17    10*     > RETURN_BY_REF                                            null

End of function %00%7Bclosure%7D%2Fin%2Fec5fg%3A11%241

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.31 ms | 1405 KiB | 15 Q