3v4l.org

run code in 200+ PHP versions simultaneously
<?php set_error_handler( function($error_num, $message, $file_name, $line_num) { $trace = debug_backtrace(); foreach($trace as $trace_row){ array_walk_recursive($trace, function(&$val, $index){ $max_length = 100; //The strlen(...) function has to be passed a string value, so convert objects to their respective class names - otherwise an error will be thrown if ( is_object($val) ) { $val = get_class($val); } $length = strlen($val); if( $length > $max_length ){ $val = substr($val, 0, $max_length) . "...(original length $length)"; } }); } return true; } ); class A{ function do_stuff(&$b) { var_dump('Before in function:', $b); $defined = 0; #trigger_error("If I fixed the undefined variable but enabled this line instead, it will also turn b from an object into a string! So user-triggered notices bork it as well."); $x = $undefined || $defined ? 14 : 0; var_dump('After in function:', $b); } } class B{} $a = new A(); $b = new B(); $a->do_stuff($b); var_dump('After function:', $b); ?>
based on fZij6
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FUqWS
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a, !1 = $b
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   INIT_FCALL                                               'set_error_handler'
   3     1        RAISE_ABSTRACT_ERROR                             ~2      '%00%7Bclosure%7D%2Fin%2FFUqWS0x7f208d673770'
  22     2        SEND_VAL                                                 ~2
         3        DO_ICALL                                                 
  37     4        NEW                                              $4      :25
         5        DO_FCALL                                      0          
         6        QM_ASSIGN                                                !0
  38     7        NEW                                              $7      :21
         8        DO_FCALL                                      0          
         9        QM_ASSIGN                                                !1
  40    10        INIT_METHOD_CALL                                         !0, 'do_stuff'
        11        SEND_VAR_EX                                              !1
        12        DO_FCALL                                      0          
  42    13        INIT_FCALL                                               'var_dump'
        14        SEND_VAL                                                 'After+function%3A'
        15        SEND_VAR                                                 !1
        16        DO_ICALL                                                 
  43    17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FFUqWS0x7f208d673770:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/FUqWS
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $error_num, !1 = $message, !2 = $file_name, !3 = $line_num, !4 = $trace, !5 = $trace_row
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   RECV                                             !0      
         1        RECV                                             !1      
         2        RECV                                             !2      
         3        RECV                                             !3      
   4     4        INIT_FCALL                                               'debug_backtrace'
         5        DO_ICALL                                         $6      
         6        QM_ASSIGN                                                !4
   5     7      > FE_RESET_R                                       $8      !4, ->15
         8    > > FE_FETCH_R                                               $8, !5, ->15
   6     9    >   INIT_FCALL                                               'array_walk_recursive'
        10        SEND_REF                                                 !4
        11        RAISE_ABSTRACT_ERROR                             ~9      '%00%7Bclosure%7D%2Fin%2FFUqWS0x7f208d673757'
  18    12        SEND_VAL                                                 ~9
        13        DO_ICALL                                                 
   5    14      > JMP                                                      ->8
        15    >   FE_FREE                                                  $8
  21    16      > RETURN                                                   <true>
  22    17*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFUqWS0x7f208d673770

Function %00%7Bclosure%7D%2Fin%2FFUqWS0x7f208d673757:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 7
filename:       /in/FUqWS
function name:  {closure}
number of ops:  22
compiled vars:  !0 = $val, !1 = $index, !2 = $max_length, !3 = $length
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   6     0  E >   RECV                                             !0      
         1        RECV                                             !1      
   7     2        QM_ASSIGN                                                !2
  10     3        TYPE_CHECK                                  256  ~5      !0
         4      > JMPZ                                                     ~5, ->7
  11     5    >   GET_CLASS                                        ~6      !0
         6        QM_ASSIGN                                                !0
  13     7    >   STRLEN                                           ~8      !0
         8        QM_ASSIGN                                                !3
  15     9        IS_SMALLER_OR_EQUAL                              ~10     !2, !3
        10      > JMPZ                                                     ~10, ->21
  16    11    >   INIT_FCALL                                               'substr'
        12        SEND_VAR                                                 !0
        13        SEND_VAL                                                 0
        14        SEND_VAR                                                 !2
        15        DO_ICALL                                         $11     
        16        ROPE_INIT                                     3  ~13     '...%28original+length+'
        17        ROPE_ADD                                      1  ~13     ~13, !3
        18        ROPE_END                                      2  ~12     ~13, '%29'
        19        CONCAT                                           ~15     $11, ~12
        20        QM_ASSIGN                                                !0
  18    21    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFUqWS0x7f208d673757

Class A:
Function do_stuff:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/FUqWS
function name:  do_stuff
number of ops:  18
compiled vars:  !0 = $b, !1 = $defined, !2 = $x, !3 = $undefined
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  26     0  E >   RECV                                             !0      
  27     1        INIT_FCALL                                               'var_dump'
         2        SEND_VAL                                                 'Before+in+function%3A'
         3        SEND_VAR                                                 !0
         4        DO_ICALL                                                 
  28     5        QM_ASSIGN                                                !1
  30     6      > JMPNZ_EX                                         ~6      !3, ->8
         7    >   BOOL                                             ~6      !1
         8    > > JMPZ                                                     ~6, ->11
         9    >   ASSIGN_BW_OR                                  0  ~7      14
        10      > JMP                                                      ->12
        11    >   ASSIGN_BW_OR                                  0  ~7      0
        12    >   QM_ASSIGN                                                !2
  31    13        INIT_FCALL                                               'var_dump'
        14        SEND_VAL                                                 'After+in+function%3A'
        15        SEND_VAR                                                 !0
        16        DO_ICALL                                                 
  32    17      > RETURN                                                   null

End of function do_stuff

End of class A.

Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 7.4.0