3v4l.org

run code in 300+ PHP versions simultaneously
<?php function start() { $GLOBALS['start'] = microtime(true); } function stop($return=false) { $time = microtime(true) - $GLOBALS['start']; if($return) { return $time; } else { printf("\n\n%.20f seconds\n\n", $time); } } $ruleMatch = $exclude = true; $itemId = 10000; start(); for($i=0;$i<1000;$i++) { $allowedItems = range(1, 10000); // if ($ruleMatch && $exclude && ($key = array_search($itemId, $allowedItems))!==false) { unset($allowedItems[$key]); } // } stop(); start(); for($i=0;$i<1000;$i++) { $allowedItems = range(1, 10000); // $flipped = array_flip($allowedItems); if ($ruleMatch && $exclude && isset($flipped[$itemId])) { unset($allowedItems[$flipped[$itemId]]); } // } stop();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 7
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 33
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
2 jumps found. (Code = 46) Position 1 = 43, Position 2 = 44
Branch analysis from position: 43
2 jumps found. (Code = 46) Position 1 = 45, Position 2 = 47
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 50
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 33
Branch analysis from position: 53
Branch analysis from position: 33
Branch analysis from position: 50
Branch analysis from position: 47
Branch analysis from position: 44
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 7
Branch analysis from position: 27
Branch analysis from position: 7
Branch analysis from position: 24
Branch analysis from position: 22
Branch analysis from position: 14
filename:       /in/riIsS
function name:  (null)
number of ops:  56
compiled vars:  !0 = $ruleMatch, !1 = $exclude, !2 = $itemId, !3 = $i, !4 = $allowedItems, !5 = $key, !6 = $flipped
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                           ~7      !1, <true>
          1        ASSIGN                                                   !0, ~7
   16     2        ASSIGN                                                   !2, 10000
   18     3        INIT_FCALL                                               'start'
          4        DO_FCALL                                      0          
   19     5        ASSIGN                                                   !3, 0
          6      > JMP                                                      ->25
   20     7    >   INIT_FCALL                                               'range'
          8        SEND_VAL                                                 1
          9        SEND_VAL                                                 10000
         10        DO_ICALL                                         $12     
         11        ASSIGN                                                   !4, $12
   22    12      > JMPZ_EX                                          ~14     !0, ->14
         13    >   BOOL                                             ~14     !1
         14    > > JMPZ_EX                                          ~14     ~14, ->22
         15    >   INIT_FCALL                                               'array_search'
         16        SEND_VAR                                                 !2
         17        SEND_VAR                                                 !4
         18        DO_ICALL                                         $15     
         19        ASSIGN                                           ~16     !5, $15
         20        TYPE_CHECK                                  1018  ~17     ~16
         21        BOOL                                             ~14     ~17
         22    > > JMPZ                                                     ~14, ->24
   23    23    >   UNSET_DIM                                                !4, !5
   19    24    >   PRE_INC                                                  !3
         25    >   IS_SMALLER                                               !3, 1000
         26      > JMPNZ                                                    ~19, ->7
   27    27    >   INIT_FCALL                                               'stop'
         28        DO_FCALL                                      0          
   29    29        INIT_FCALL                                               'start'
         30        DO_FCALL                                      0          
   30    31        ASSIGN                                                   !3, 0
         32      > JMP                                                      ->51
   31    33    >   INIT_FCALL                                               'range'
         34        SEND_VAL                                                 1
         35        SEND_VAL                                                 10000
         36        DO_ICALL                                         $23     
         37        ASSIGN                                                   !4, $23
   33    38        INIT_FCALL                                               'array_flip'
         39        SEND_VAR                                                 !4
         40        DO_ICALL                                         $25     
         41        ASSIGN                                                   !6, $25
   34    42      > JMPZ_EX                                          ~27     !0, ->44
         43    >   BOOL                                             ~27     !1
         44    > > JMPZ_EX                                          ~27     ~27, ->47
         45    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~28     !6, !2
         46        BOOL                                             ~27     ~28
         47    > > JMPZ                                                     ~27, ->50
   35    48    >   FETCH_DIM_R                                      ~29     !6, !2
         49        UNSET_DIM                                                !4, ~29
   30    50    >   PRE_INC                                                  !3
         51    >   IS_SMALLER                                               !3, 1000
         52      > JMPNZ                                                    ~31, ->33
   39    53    >   INIT_FCALL                                               'stop'
         54        DO_FCALL                                      0          
         55      > RETURN                                                   1

Function start:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/riIsS
function name:  start
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $1      
          3        FETCH_W                      global              $0      'start'
          4        ASSIGN                                                   $0, $1
    5     5      > RETURN                                                   null

End of function start

Function stop:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/riIsS
function name:  stop
number of ops:  15
compiled vars:  !0 = $return, !1 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      <false>
    8     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $2      
          4        FETCH_R                      global              ~3      'start'
          5        SUB                                              ~4      $2, ~3
          6        ASSIGN                                                   !1, ~4
    9     7      > JMPZ                                                     !0, ->10
   10     8    > > RETURN                                                   !1
    9     9*       JMP                                                      ->14
   12    10    >   INIT_FCALL                                               'printf'
         11        SEND_VAL                                                 '%0A%0A%25.20f+seconds%0A%0A'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
   14    14      > RETURN                                                   null

End of function stop

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.33 ms | 1026 KiB | 22 Q