3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!defined('PHP_VERSION_ID')) { $version = explode('.', PHP_VERSION); define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); } function a($depth = 0) { //return last backtrace call. If backtrace bigger then 3, return third call. if($depth === 1000) { if(PHP_VERSION_ID >= 50400) { return array_slice(array_filter(array_slice(debug_backtrace(~ DEBUG_BACKTRACE_PROVIDE_OBJECT & ~ DEBUG_BACKTRACE_IGNORE_ARGS, 3), 0, 3)), -1, 1); } elseif(PHP_VERSION_ID >= 50306) { return array_slice(array_filter(array_slice(debug_backtrace(~ DEBUG_BACKTRACE_PROVIDE_OBJECT), 0, 3)), -1, 1); } elseif(PHP_VERSION_ID >= 50101) { return array_slice(array_filter(array_slice(debug_backtrace(FALSE), 0, 3)), -1, 1); } else return array_slice(array_filter(array_slice(debug_backtrace(), 0, 3)), -1, 1); } return a(++$depth, str_repeat("a", 1000)); } var_dump(a());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 1, Position 2 = 17
Branch analysis from position: 1
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/qvl2h
function name:  (null)
number of ops:  23
compiled vars:  !0 = $version
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > JMPZ                                                     <false>, ->17
    4     1    >   INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAL                                                 '8.0.0'
          4        DO_ICALL                                         $1      
          5        ASSIGN                                                   !0, $1
    6     6        INIT_FCALL                                               'define'
          7        SEND_VAL                                                 'PHP_VERSION_ID'
          8        FETCH_DIM_R                                      ~3      !0, 0
          9        MUL                                              ~4      ~3, 10000
         10        FETCH_DIM_R                                      ~5      !0, 1
         11        MUL                                              ~6      ~5, 100
         12        ADD                                              ~7      ~4, ~6
         13        FETCH_DIM_R                                      ~8      !0, 2
         14        ADD                                              ~9      ~7, ~8
         15        SEND_VAL                                                 ~9
         16        DO_ICALL                                                 
   32    17    >   INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'a'
         19        DO_FCALL                                      0  $11     
         20        SEND_VAR                                                 $11
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function a:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 77
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 42
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 61
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qvl2h
function name:  a
number of ops:  88
compiled vars:  !0 = $depth
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                        !0      0
   12     1        IS_IDENTICAL                                             !0, 1000
          2      > JMPZ                                                     ~1, ->77
   14     3    > > JMPZ                                                     <true>, ->23
   15     4    >   INIT_FCALL                                               'array_slice'
          5        INIT_FCALL                                               'array_filter'
          6        INIT_FCALL                                               'array_slice'
          7        INIT_FCALL                                               'debug_backtrace'
          8        SEND_VAL                                                 -4
          9        SEND_VAL                                                 3
         10        DO_ICALL                                         $2      
         11        SEND_VAR                                                 $2
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 3
         14        DO_ICALL                                         $3      
         15        SEND_VAR                                                 $3
         16        DO_ICALL                                         $4      
         17        SEND_VAR                                                 $4
         18        SEND_VAL                                                 -1
         19        SEND_VAL                                                 1
         20        DO_ICALL                                         $5      
         21      > RETURN                                                   $5
         22*       JMP                                                      ->77
   18    23    > > JMPZ                                                     <true>, ->42
   19    24    >   INIT_FCALL                                               'array_slice'
         25        INIT_FCALL                                               'array_filter'
         26        INIT_FCALL                                               'array_slice'
         27        INIT_FCALL                                               'debug_backtrace'
         28        SEND_VAL                                                 -2
         29        DO_ICALL                                         $6      
         30        SEND_VAR                                                 $6
         31        SEND_VAL                                                 0
         32        SEND_VAL                                                 3
         33        DO_ICALL                                         $7      
         34        SEND_VAR                                                 $7
         35        DO_ICALL                                         $8      
         36        SEND_VAR                                                 $8
         37        SEND_VAL                                                 -1
         38        SEND_VAL                                                 1
         39        DO_ICALL                                         $9      
         40      > RETURN                                                   $9
         41*       JMP                                                      ->77
   22    42    > > JMPZ                                                     <true>, ->61
   23    43    >   INIT_FCALL                                               'array_slice'
         44        INIT_FCALL                                               'array_filter'
         45        INIT_FCALL                                               'array_slice'
         46        INIT_FCALL                                               'debug_backtrace'
         47        SEND_VAL                                                 <false>
         48        DO_ICALL                                         $10     
         49        SEND_VAR                                                 $10
         50        SEND_VAL                                                 0
         51        SEND_VAL                                                 3
         52        DO_ICALL                                         $11     
         53        SEND_VAR                                                 $11
         54        DO_ICALL                                         $12     
         55        SEND_VAR                                                 $12
         56        SEND_VAL                                                 -1
         57        SEND_VAL                                                 1
         58        DO_ICALL                                         $13     
         59      > RETURN                                                   $13
         60*       JMP                                                      ->77
   26    61    >   INIT_FCALL                                               'array_slice'
         62        INIT_FCALL                                               'array_filter'
         63        INIT_FCALL                                               'array_slice'
         64        INIT_FCALL                                               'debug_backtrace'
         65        DO_ICALL                                         $14     
         66        SEND_VAR                                                 $14
         67        SEND_VAL                                                 0
         68        SEND_VAL                                                 3
         69        DO_ICALL                                         $15     
         70        SEND_VAR                                                 $15
         71        DO_ICALL                                         $16     
         72        SEND_VAR                                                 $16
         73        SEND_VAL                                                 -1
         74        SEND_VAL                                                 1
         75        DO_ICALL                                         $17     
         76      > RETURN                                                   $17
   29    77    >   INIT_FCALL_BY_NAME                                       'a'
         78        PRE_INC                                          ~18     !0
         79        SEND_VAL_EX                                              ~18
         80        INIT_FCALL                                               'str_repeat'
         81        SEND_VAL                                                 'a'
         82        SEND_VAL                                                 1000
         83        DO_ICALL                                         $19     
         84        SEND_VAR_NO_REF_EX                                       $19
         85        DO_FCALL                                      0  $20     
         86      > RETURN                                                   $20
   30    87*     > RETURN                                                   null

End of function a

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.1 ms | 952 KiB | 29 Q