3v4l.org

run code in 300+ PHP versions simultaneously
<?php // performance hit processing non-fatal errors w/ custom error handler (e_notice, e_warning) // affects versions 7.4.7 & 7.4.8 // array of seq. ints $start = 3; $number_of_values = 5000; $seq_array = range($start, $start+$number_of_values-1); // set error handler function error_handler_fn($errno, $errstr, $errfile, $errline) { $dummy = '0'; // print_r(implode(", ", Array($errno, $errstr, $errfile, $errline))."\n"); } set_error_handler("error_handler_fn"); // array to index $array = Array(1,2,3); // run loop $t1 = microtime(true); foreach ($seq_array as $val) { $nothing = $array[$val]; // E_NOTICE (8) - try to index array at undefined index (performance issue) // $nothing2 = count(); // E_WARNING (2) - try to count nothing (similar performance issue) } $t2 = microtime(true); $outmsg = "\n\nRun time: " . round(($t2-$t1)*1000.,2) . " milliseconds (" . phpversion() . ")"; print_r($outmsg); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/WcFJK
function name:  (null)
number of ops:  44
compiled vars:  !0 = $start, !1 = $number_of_values, !2 = $seq_array, !3 = $array, !4 = $t1, !5 = $val, !6 = $nothing, !7 = $t2, !8 = $outmsg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 3
    8     1        ASSIGN                                                   !1, 5000
    9     2        INIT_FCALL                                               'range'
          3        SEND_VAR                                                 !0
          4        ADD                                              ~11     !0, !1
          5        SUB                                              ~12     ~11, 1
          6        SEND_VAL                                                 ~12
          7        DO_ICALL                                         $13     
          8        ASSIGN                                                   !2, $13
   16     9        INIT_FCALL                                               'set_error_handler'
         10        SEND_VAL                                                 'error_handler_fn'
         11        DO_ICALL                                                 
   19    12        ASSIGN                                                   !3, <array>
   22    13        INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $17     
         16        ASSIGN                                                   !4, $17
   23    17      > FE_RESET_R                                       $19     !2, ->22
         18    > > FE_FETCH_R                                               $19, !5, ->22
   25    19    >   FETCH_DIM_R                                      ~20     !3, !5
         20        ASSIGN                                                   !6, ~20
   23    21      > JMP                                                      ->18
         22    >   FE_FREE                                                  $19
   30    23        INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $22     
         26        ASSIGN                                                   !7, $22
   31    27        INIT_FCALL                                               'round'
         28        SUB                                              ~24     !7, !4
         29        MUL                                              ~25     ~24, 1000
         30        SEND_VAL                                                 ~25
         31        SEND_VAL                                                 2
         32        DO_ICALL                                         $26     
         33        CONCAT                                           ~27     '%0A%0ARun+time%3A+', $26
         34        CONCAT                                           ~28     ~27, '+milliseconds+%28'
         35        INIT_FCALL                                               'phpversion'
         36        DO_ICALL                                         $29     
         37        CONCAT                                           ~30     ~28, $29
         38        CONCAT                                           ~31     ~30, '%29'
         39        ASSIGN                                                   !8, ~31
   32    40        INIT_FCALL                                               'print_r'
         41        SEND_VAR                                                 !8
         42        DO_ICALL                                                 
   34    43      > RETURN                                                   1

Function error_handler_fn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WcFJK
function name:  error_handler_fn
number of ops:  6
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline, !4 = $dummy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   13     4        ASSIGN                                                   !4, '0'
   15     5      > RETURN                                                   null

End of function error_handler_fn

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.04 ms | 1405 KiB | 25 Q