3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj = new ninja(); $color = 'black'; print_r($obj->{$color.'_field'}); $val = $obj->{$color.'_method'}('sup'); print_r($val); $color = 'white'; print_r($obj->{$color.'_field'}); $val = $obj->{$color.'_method'}('sup'); print_r($val); class ninja { public $black_field = array('black ninja'); public $white_field = array('white ninja'); public function black_method($param) { return $param.' in black method'; } public function white_method($param) { return $param.' in black method'; } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nbQPb
function name:  (null)
number of ops:  32
compiled vars:  !0 = $obj, !1 = $color, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'ninja'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
    5     3        ASSIGN                                                   !1, 'black'
    6     4        INIT_FCALL                                               'print_r'
          5        CONCAT                                           ~7      !1, '_field'
          6        FETCH_OBJ_R                                      ~8      !0, ~7
          7        SEND_VAL                                                 ~8
          8        DO_ICALL                                                 
    7     9        CONCAT                                           ~10     !1, '_method'
         10        INIT_METHOD_CALL                                         !0, ~10
         11        SEND_VAL_EX                                              'sup'
         12        DO_FCALL                                      0  $11     
         13        ASSIGN                                                   !2, $11
    8    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                                 
   10    17        ASSIGN                                                   !1, 'white'
   11    18        INIT_FCALL                                               'print_r'
         19        CONCAT                                           ~15     !1, '_field'
         20        FETCH_OBJ_R                                      ~16     !0, ~15
         21        SEND_VAL                                                 ~16
         22        DO_ICALL                                                 
   12    23        CONCAT                                           ~18     !1, '_method'
         24        INIT_METHOD_CALL                                         !0, ~18
         25        SEND_VAL_EX                                              'sup'
         26        DO_FCALL                                      0  $19     
         27        ASSIGN                                                   !2, $19
   13    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                                 
   29    31      > RETURN                                                   1

Class ninja:
Function black_method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nbQPb
function name:  black_method
number of ops:  4
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        CONCAT                                           ~1      !0, '+in+black+method'
          2      > RETURN                                                   ~1
   23     3*     > RETURN                                                   null

End of function black_method

Function white_method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nbQPb
function name:  white_method
number of ops:  4
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   26     1        CONCAT                                           ~1      !0, '+in+black+method'
          2      > RETURN                                                   ~1
   27     3*     > RETURN                                                   null

End of function white_method

End of class ninja.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.65 ms | 1400 KiB | 15 Q