3v4l.org

run code in 500+ PHP versions simultaneously
<?php function dump(...$values): void { foreach ($values as $value) { echo json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL; } } class Foo { public readonly Exception $e; public function __construct() { $this->e = new Exception; dump(debug_backtrace()); } } class Bar extends Foo { public function __construct() { parent::__construct(); } } function Bar(): Bar { return new Bar(); } $bar = new Bar(); dump($bar->e->getTrace());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QjBWV
function name:  (null)
number of ops:  10
compiled vars:  !0 = $bar
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   33     0  E >   NEW                                                  $1      'Bar'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   34     3        INIT_FCALL                                                   'dump'
          4        FETCH_OBJ_R                                          ~4      !0, 'e'
          5        INIT_METHOD_CALL                                             ~4, 'getTrace'
          6        DO_FCALL                                          0  $5      
          7        SEND_VAR                                                     $5
          8        DO_FCALL                                          0          
          9      > RETURN                                                       1

Function dump:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/QjBWV
function name:  dump
number of ops:  12
compiled vars:  !0 = $values, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV_VARIADIC                                        !0      
    5     1      > FE_RESET_R                                           $2      !0, ->10
          2    > > FE_FETCH_R                                                   $2, !1, ->10
    6     3    >   INIT_FCALL                                                   'json_encode'
          4        SEND_VAR                                                     !1
          5        SEND_VAL                                                     192
          6        DO_ICALL                                             $3      
          7        ECHO                                                         $3
          8        ECHO                                                         '%0A'
    5     9      > JMP                                                          ->2
         10    >   FE_FREE                                                      $2
    8    11      > RETURN                                                       null

End of function dump

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QjBWV
function name:  Bar
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   NEW                                                  $0      'Bar'
          1        DO_FCALL                                          0          
          2        VERIFY_RETURN_TYPE                                           $0
          3      > RETURN                                                       $0
   31     4*       VERIFY_RETURN_TYPE                                           
          5*     > RETURN                                                       null

End of function bar

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QjBWV
function name:  __construct
number of ops:  10
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   NEW                                                  $1      'Exception'
          1        DO_FCALL                                          0          
          2        ASSIGN_OBJ                                                   'e'
          3        OP_DATA                                                      $1
   16     4        INIT_FCALL                                                   'dump'
          5        INIT_FCALL                                                   'debug_backtrace'
          6        DO_ICALL                                             $3      
          7        SEND_VAR                                                     $3
          8        DO_FCALL                                          0          
   17     9      > RETURN                                                       null

End of function __construct

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QjBWV
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   INIT_STATIC_METHOD_CALL                                      
          1        DO_FCALL                                          0          
   25     2      > RETURN                                                       null

End of function __construct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
188.98 ms | 1641 KiB | 17 Q