3v4l.org

run code in 300+ PHP versions simultaneously
<?php class P { function r($o,$p) { if($v=get_object_vars($o)&&@$v=$v[$p]) return$v; $m=['set','get','has','is']; while(!method_exists($o,current($m).$p)) next($m); return$o->$m(); } } class A { private $a = 'hello'; public function getA() { return $this->a; } } $a = new A(); $p = new P(); echo $p->r($a, 'a');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iQ474
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a, !1 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   27     3        NEW                                              $5      'P'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   29     6        INIT_METHOD_CALL                                         !1, 'r'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAL_EX                                              'a'
          9        DO_FCALL                                      0  $8      
         10        ECHO                                                     $8
         11      > RETURN                                                   1

Class P:
Function r:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 16
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 16
Branch analysis from position: 29
Branch analysis from position: 16
Branch analysis from position: 11
filename:       /in/iQ474
function name:  r
number of ops:  33
compiled vars:  !0 = $o, !1 = $p, !2 = $v, !3 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'get_object_vars'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5      > JMPZ_EX                                          ~5      $4, ->11
          6    >   BEGIN_SILENCE                                    ~6      
          7        FETCH_DIM_R                                      ~7      !2, !1
          8        ASSIGN                                           ~8      !2, ~7
          9        END_SILENCE                                              ~6
         10        BOOL                                             ~5      ~8
         11    >   ASSIGN                                           ~9      !2, ~5
         12      > JMPZ                                                     ~9, ->14
    8    13    > > RETURN                                                   !2
   10    14    >   ASSIGN                                                   !3, <array>
   12    15      > JMP                                                      ->19
   13    16    >   INIT_FCALL                                               'next'
         17        SEND_REF                                                 !3
         18        DO_ICALL                                                 
   12    19    >   INIT_FCALL                                               'method_exists'
         20        SEND_VAR                                                 !0
         21        INIT_FCALL                                               'current'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $12     
         24        CONCAT                                           ~13     $12, !1
         25        SEND_VAL                                                 ~13
         26        DO_ICALL                                         $14     
         27        BOOL_NOT                                         ~15     $14
         28      > JMPNZ                                                    ~15, ->16
   15    29    >   INIT_METHOD_CALL                                         !0, !3
         30        DO_FCALL                                      0  $16     
         31      > RETURN                                                   $16
   16    32*     > RETURN                                                   null

End of function r

End of class P.

Class A:
Function geta:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iQ474
function name:  getA
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   FETCH_OBJ_R                                      ~0      'a'
          1      > RETURN                                                   ~0
          2*     > RETURN                                                   null

End of function geta

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.34 ms | 1392 KiB | 21 Q