3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { private $baz = 'tab'; } $bar = new Bar(); $accessor = function () { return $this->baz; }; var_dump($accessor()); $accessor = Closure::bind($accessor, $bar, 'Bar'); var_dump($accessor());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tDHtR
function name:  (null)
number of ops:  22
compiled vars:  !0 = $bar, !1 = $accessor
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $2      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   10     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FtDHtR%3A10%240'
          4        ASSIGN                                                   !1, ~5
   12     5        INIT_FCALL                                               'var_dump'
          6        INIT_DYNAMIC_CALL                                        !1
          7        DO_FCALL                                      0  $7      
          8        SEND_VAR                                                 $7
          9        DO_ICALL                                                 
   14    10        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
         11        SEND_VAR                                                 !1
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 'Bar'
         14        DO_FCALL                                      0  $9      
         15        ASSIGN                                                   !1, $9
   16    16        INIT_FCALL                                               'var_dump'
         17        INIT_DYNAMIC_CALL                                        !1
         18        DO_FCALL                                      0  $11     
         19        SEND_VAR                                                 $11
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FtDHtR%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tDHtR
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_THIS                                       $0      
          1        FETCH_OBJ_R                                      ~1      $0, 'baz'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

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

Class Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.36 ms | 1395 KiB | 15 Q