3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private function x() { # retrieve caller name $calledby = debug_backtrace(); print_r($calledby); // does not work $caller = (strlen($calledby[1]['class'])) ? $calledby[1]['class'] : $calledby[0]['class']; // works and does does not segfault if (strlen($calledby[1]['class'])) $caller = $calledby[1]['class']; else $caller = $calledby[0]['class']; # arguments are required if (!func_num_args()) { return; } # fill variables with argument contents if exists $variables = (func_num_args() == 0) ? NULL : (is_array(func_get_arg(0)) ? func_get_arg(0) : NULL); } public function __construct() { $this->x("Whaa"); } } new A();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QdaFF
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $0      'A'
          1        DO_FCALL                                      0          
          2        FREE                                                     $0
          3      > RETURN                                                   1

Class A:
Function x:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 33
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 38
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 48
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 33
Branch analysis from position: 32
Branch analysis from position: 33
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
Branch analysis from position: 26
filename:       /in/QdaFF
function name:  x
number of ops:  52
compiled vars:  !0 = $calledby, !1 = $caller, !2 = $variables
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'debug_backtrace'
          1        DO_ICALL                                         $3      
          2        ASSIGN                                                   !0, $3
          3        INIT_FCALL                                               'print_r'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
    8     6        FETCH_DIM_R                                      ~6      !0, 1
          7        FETCH_DIM_R                                      ~7      ~6, 'class'
          8        STRLEN                                           ~8      ~7
          9      > JMPZ                                                     ~8, ->14
         10    >   FETCH_DIM_R                                      ~9      !0, 1
         11        FETCH_DIM_R                                      ~10     ~9, 'class'
         12        QM_ASSIGN                                        ~11     ~10
         13      > JMP                                                      ->17
         14    >   FETCH_DIM_R                                      ~12     !0, 0
         15        FETCH_DIM_R                                      ~13     ~12, 'class'
         16        QM_ASSIGN                                        ~11     ~13
         17    >   ASSIGN                                                   !1, ~11
   10    18        FETCH_DIM_R                                      ~15     !0, 1
         19        FETCH_DIM_R                                      ~16     ~15, 'class'
         20        STRLEN                                           ~17     ~16
         21      > JMPZ                                                     ~17, ->26
         22    >   FETCH_DIM_R                                      ~18     !0, 1
         23        FETCH_DIM_R                                      ~19     ~18, 'class'
         24        ASSIGN                                                   !1, ~19
         25      > JMP                                                      ->29
   11    26    >   FETCH_DIM_R                                      ~21     !0, 0
         27        FETCH_DIM_R                                      ~22     ~21, 'class'
         28        ASSIGN                                                   !1, ~22
   14    29    >   FUNC_NUM_ARGS                                    ~24     
         30        BOOL_NOT                                         ~25     ~24
         31      > JMPZ                                                     ~25, ->33
         32    > > RETURN                                                   null
   16    33    >   FUNC_NUM_ARGS                                    ~26     
         34        IS_EQUAL                                                 ~26, 0
         35      > JMPZ                                                     ~27, ->38
         36    >   QM_ASSIGN                                        ~28     null
         37      > JMP                                                      ->50
         38    >   INIT_FCALL                                               'func_get_arg'
         39        SEND_VAL                                                 0
         40        DO_ICALL                                         $29     
         41        TYPE_CHECK                                  128          $29
         42      > JMPZ                                                     ~30, ->48
         43    >   INIT_FCALL                                               'func_get_arg'
         44        SEND_VAL                                                 0
         45        DO_ICALL                                         $31     
         46        QM_ASSIGN                                        ~32     $31
         47      > JMP                                                      ->49
         48    >   QM_ASSIGN                                        ~32     null
         49    >   QM_ASSIGN                                        ~28     ~32
         50    >   ASSIGN                                                   !2, ~28
   17    51      > RETURN                                                   null

End of function x

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QdaFF
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_METHOD_CALL                                         'x'
          1        SEND_VAL                                                 'Whaa'
          2        DO_FCALL                                      0          
   21     3      > RETURN                                                   null

End of function __construct

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.45 ms | 1400 KiB | 19 Q