3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { private $foo = 'foo'; } $getState = function () { return $this->foo; }; $foo = new Foo(); $getStateBound = $getState->bindTo($foo, $foo); var_dump($getStateBound()); $viaStatic = Closure::bind($getState, $foo, $foo); var_dump($viaStatic());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rrY4u
function name:  (null)
number of ops:  27
compiled vars:  !0 = $getState, !1 = $foo, !2 = $getStateBound, !3 = $viaStatic
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          1        ASSIGN                                                       !0, ~4
   10     2        NEW                                                  $6      'Foo'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !1, $6
   12     5        INIT_METHOD_CALL                                             !0, 'bindTo'
          6        SEND_VAR_EX                                                  !1
          7        SEND_VAR_EX                                                  !1
          8        DO_FCALL                                          0  $9      
          9        ASSIGN                                                       !2, $9
   13    10        INIT_FCALL                                                   'var_dump'
         11        INIT_DYNAMIC_CALL                                            !2
         12        DO_FCALL                                          0  $11     
         13        SEND_VAR                                                     $11
         14        DO_ICALL                                                     
   15    15        INIT_STATIC_METHOD_CALL                                      'Closure', 'bind'
         16        SEND_VAR                                                     !0
         17        SEND_VAR                                                     !1
         18        SEND_VAR                                                     !1
         19        DO_FCALL                                          0  $13     
         20        ASSIGN                                                       !3, $13
   16    21        INIT_FCALL                                                   'var_dump'
         22        INIT_DYNAMIC_CALL                                            !3
         23        DO_FCALL                                          0  $15     
         24        SEND_VAR                                                     $15
         25        DO_ICALL                                                     
         26      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rrY4u
function name:  {closure:/in/rrY4u:8}
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   FETCH_THIS                                           $0      
          1        FETCH_OBJ_R                                          ~1      $0, 'foo'
          2      > RETURN                                                       ~1
          3*     > RETURN                                                       null

End of Dynamic Function 0

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.12 ms | 1526 KiB | 9 Q