3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = array( '$empty' => array(), '$full' => range(1, 10), ); $count = 1 * 1000 * 1000; foreach ($tests as $name => $array) { printf("%-10s", $name); $start = microtime(true); $i = $count; while ($i-- > 0) { (bool) $array; } $total = microtime(true) - $start; printf("%0.4F sec total, %0.4F sec/iter\n", $total, $total / $count); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 37
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 37
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 21
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 21
Branch analysis from position: 25
Branch analysis from position: 21
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/aaZ70
function name:  (null)
number of ops:  39
compiled vars:  !0 = $tests, !1 = $count, !2 = $array, !3 = $name, !4 = $start, !5 = $i, !6 = $total
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_ARRAY                                       ~7      <array>, '%24empty'
    5     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 10
          4        DO_ICALL                                         $8      
          5        ADD_ARRAY_ELEMENT                                ~7      $8, '%24full'
    3     6        ASSIGN                                                   !0, ~7
    7     7        ASSIGN                                                   !1, 1000000
    9     8      > FE_RESET_R                                       $11     !0, ->37
          9    > > FE_FETCH_R                                       ~12     $11, !2, ->37
         10    >   ASSIGN                                                   !3, ~12
   10    11        INIT_FCALL                                               'printf'
         12        SEND_VAL                                                 '%25-10s'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                                 
   12    15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $15     
         18        ASSIGN                                                   !4, $15
   14    19        ASSIGN                                                   !5, !1
   15    20      > JMP                                                      ->22
   16    21    >   BOOL                                             ~18     !2
   15    22    >   POST_DEC                                         ~19     !5
         23        IS_SMALLER                                               0, ~19
         24      > JMPNZ                                                    ~20, ->21
   19    25    >   INIT_FCALL                                               'microtime'
         26        SEND_VAL                                                 <true>
         27        DO_ICALL                                         $21     
         28        SUB                                              ~22     $21, !4
         29        ASSIGN                                                   !6, ~22
   20    30        INIT_FCALL                                               'printf'
         31        SEND_VAL                                                 '%250.4F+sec+total%2C+%250.4F+sec%2Fiter%0A'
         32        SEND_VAR                                                 !6
         33        DIV                                              ~24     !6, !1
         34        SEND_VAL                                                 ~24
         35        DO_ICALL                                                 
    9    36      > JMP                                                      ->9
         37    >   FE_FREE                                                  $11
   21    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.43 ms | 1400 KiB | 19 Q