3v4l.org

run code in 500+ PHP versions simultaneously
<?php final class Guard { private $x = 'test'; } $guard = new Guard(); $thief = function ($name) { return $this->$name; }; $hydrator = function ($name, $value) { $this->$name = $value; }; echo $thief->bindTo($guard, Guard::class)('x') . "\n"; $hydrator->bindTo($guard, Guard::class)('x', 'bla'); echo $thief->bindTo($guard, Guard::class)('x') . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GqaLf
function name:  (null)
number of ops:  34
compiled vars:  !0 = $guard, !1 = $thief, !2 = $hydrator
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   NEW                                                  $3      'Guard'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
   10     3        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
          4        ASSIGN                                                       !1, ~6
   15     5        DECLARE_LAMBDA_FUNCTION                              ~8      [1]
          6        ASSIGN                                                       !2, ~8
   20     7        INIT_METHOD_CALL                                             !1, 'bindTo'
          8        SEND_VAR_EX                                                  !0
          9        SEND_VAL_EX                                                  'Guard'
         10        DO_FCALL                                          0  $10     
         11        INIT_DYNAMIC_CALL                                            $10
         12        SEND_VAL_EX                                                  'x'
         13        DO_FCALL                                          0  $11     
         14        CONCAT                                               ~12     $11, '%0A'
         15        ECHO                                                         ~12
   22    16        INIT_METHOD_CALL                                             !2, 'bindTo'
         17        SEND_VAR_EX                                                  !0
         18        SEND_VAL_EX                                                  'Guard'
         19        DO_FCALL                                          0  $13     
         20        INIT_DYNAMIC_CALL                                            $13
         21        SEND_VAL_EX                                                  'x'
         22        SEND_VAL_EX                                                  'bla'
         23        DO_FCALL                                          0          
   24    24        INIT_METHOD_CALL                                             !1, 'bindTo'
         25        SEND_VAR_EX                                                  !0
         26        SEND_VAL_EX                                                  'Guard'
         27        DO_FCALL                                          0  $15     
         28        INIT_DYNAMIC_CALL                                            $15
         29        SEND_VAL_EX                                                  'x'
         30        DO_FCALL                                          0  $16     
         31        CONCAT                                               ~17     $16, '%0A'
         32        ECHO                                                         ~17
         33      > 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/GqaLf
function name:  {closure:/in/GqaLf:10}
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
   12     1        FETCH_THIS                                           $1      
          2        FETCH_OBJ_R                                          ~2      $1, !0
          3      > RETURN                                                       ~2
   13     4*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GqaLf
function name:  {closure:/in/GqaLf:15}
number of ops:  6
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   16     2        FETCH_THIS                                           $2      
          3        ASSIGN_OBJ                                                   $2, !0
          4        OP_DATA                                                      !1
   17     5      > RETURN                                                       null

End of Dynamic Function 1

Class Guard: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
176.32 ms | 1655 KiB | 13 Q