3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = range(0, 100000); $time = microtime(true); $b = array_filter($a, function($el) { return $el % 2 === 0; }); var_dump(microtime(true) - $time); $b = []; $time = microtime(true); foreach ($a as $el) { if ($el % 2 === 0) { $b[] = $el; } } var_dump(microtime(true) - $time);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 35
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 35
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 34
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/F1fNT
function name:  (null)
number of ops:  44
compiled vars:  !0 = $a, !1 = $time, !2 = $b, !3 = $el
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 100000
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
    6     5        INIT_FCALL                                               'microtime'
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
    7     9        INIT_FCALL                                               'array_filter'
         10        SEND_VAR                                                 !0
         11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FF1fNT%3A7%240'
         12        SEND_VAL                                                 ~8
         13        DO_ICALL                                         $9      
         14        ASSIGN                                                   !2, $9
    8    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $11     
         19        SUB                                              ~12     $11, !1
         20        SEND_VAL                                                 ~12
         21        DO_ICALL                                                 
   10    22        ASSIGN                                                   !2, <array>
   12    23        INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $15     
         26        ASSIGN                                                   !1, $15
   14    27      > FE_RESET_R                                       $17     !0, ->35
         28    > > FE_FETCH_R                                               $17, !3, ->35
   15    29    >   MOD                                              ~18     !3, 2
         30        IS_IDENTICAL                                             ~18, 0
         31      > JMPZ                                                     ~19, ->34
   16    32    >   ASSIGN_DIM                                               !2
         33        OP_DATA                                                  !3
   14    34    > > JMP                                                      ->28
         35    >   FE_FREE                                                  $17
   20    36        INIT_FCALL                                               'var_dump'
         37        INIT_FCALL                                               'microtime'
         38        SEND_VAL                                                 <true>
         39        DO_ICALL                                         $21     
         40        SUB                                              ~22     $21, !1
         41        SEND_VAL                                                 ~22
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FF1fNT%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F1fNT
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $el
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        MOD                                              ~1      !0, 2
          2        IS_IDENTICAL                                     ~2      ~1, 0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FF1fNT%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.7 ms | 1400 KiB | 21 Q