3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Visibility { public function __construct( public int $public, protected int $protected, private int $private, ) {} } $v = new Visibility(1, 2, 3); $reader = (fn (string $prop) => $this->$prop); $propReader = $reader->bindTo($v); var_dump($propReader('public')); var_dump($propReader('protected')); var_dump($propReader('private'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CXhqS
function name:  (null)
number of ops:  31
compiled vars:  !0 = $v, !1 = $reader, !2 = $propReader
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $3      'Visibility'
          1        SEND_VAL_EX                                              1
          2        SEND_VAL_EX                                              2
          3        SEND_VAL_EX                                              3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $3
   14     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FCXhqS%3A14%240'
          7        ASSIGN                                                   !1, ~6
   16     8        INIT_METHOD_CALL                                         !1, 'bindTo'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !2, $8
   18    12        INIT_FCALL                                               'var_dump'
         13        INIT_DYNAMIC_CALL                                        !2
         14        SEND_VAL_EX                                              'public'
         15        DO_FCALL                                      0  $10     
         16        SEND_VAR                                                 $10
         17        DO_ICALL                                                 
   19    18        INIT_FCALL                                               'var_dump'
         19        INIT_DYNAMIC_CALL                                        !2
         20        SEND_VAL_EX                                              'protected'
         21        DO_FCALL                                      0  $12     
         22        SEND_VAR                                                 $12
         23        DO_ICALL                                                 
   20    24        INIT_FCALL                                               'var_dump'
         25        INIT_DYNAMIC_CALL                                        !2
         26        SEND_VAL_EX                                              'private'
         27        DO_FCALL                                      0  $14     
         28        SEND_VAR                                                 $14
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FCXhqS%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CXhqS
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     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%2FCXhqS%3A14%240

Class Visibility:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CXhqS
function name:  __construct
number of ops:  10
compiled vars:  !0 = $public, !1 = $protected, !2 = $private
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        ASSIGN_OBJ                                               'public'
          4        OP_DATA                                                  !0
          5        ASSIGN_OBJ                                               'protected'
          6        OP_DATA                                                  !1
          7        ASSIGN_OBJ                                               'private'
          8        OP_DATA                                                  !2
    9     9      > RETURN                                                   null

End of function __construct

End of class Visibility.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.47 ms | 1400 KiB | 15 Q