3v4l.org

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

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

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

Function %00%7Bclosure%7D%2Fin%2FBQh8C%3A9%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BQh8C
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        FETCH_THIS                                       $2      
          3        ASSIGN_OBJ                                               $2, !0
          4        OP_DATA                                                  !1
          5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FBQh8C%3A9%241

Class Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.48 ms | 1400 KiB | 15 Q