3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); for ($i = 0; $i < 20000; $i++) { $a[] = array( 'name' => 'John', 'city' => 'New York', 'age' => $i % 200 == 0 ? 21 : 28 ); } $time = microtime(true); $filtered = array(); foreach ($a as $item) { if ($item['age'] == 21) $filtered[] = $item; } $time = microtime(true) - $time; echo 'explicit foreach ' . number_format($time, 3) . ' seconds and returned ' . count($filtered) . " entries\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 3
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 30
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 29
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 3
Branch analysis from position: 17
Branch analysis from position: 3
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 3
Branch analysis from position: 17
Branch analysis from position: 3
filename:       /in/sX8ZF
function name:  (null)
number of ops:  47
compiled vars:  !0 = $a, !1 = $i, !2 = $time, !3 = $filtered, !4 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->15
    8     3    >   INIT_ARRAY                                       ~8      'John', 'name'
    9     4        ADD_ARRAY_ELEMENT                                ~8      'New+York', 'city'
   10     5        MOD                                              ~9      !1, 200
          6        IS_EQUAL                                                 ~9, 0
          7      > JMPZ                                                     ~10, ->10
          8    >   QM_ASSIGN                                        ~11     21
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~11     28
         11    >   ADD_ARRAY_ELEMENT                                ~8      ~11, 'age'
    7    12        ASSIGN_DIM                                               !0
   10    13        OP_DATA                                                  ~8
    5    14        PRE_INC                                                  !1
         15    >   IS_SMALLER                                               !1, 20000
         16      > JMPNZ                                                    ~13, ->3
   14    17    >   INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $14     
         20        ASSIGN                                                   !2, $14
   16    21        ASSIGN                                                   !3, <array>
   18    22      > FE_RESET_R                                       $17     !0, ->30
         23    > > FE_FETCH_R                                               $17, !4, ->30
   20    24    >   FETCH_DIM_R                                      ~18     !4, 'age'
         25        IS_EQUAL                                                 ~18, 21
         26      > JMPZ                                                     ~19, ->29
         27    >   ASSIGN_DIM                                               !3
         28        OP_DATA                                                  !4
   18    29    > > JMP                                                      ->23
         30    >   FE_FREE                                                  $17
   23    31        INIT_FCALL                                               'microtime'
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $21     
         34        SUB                                              ~22     $21, !2
         35        ASSIGN                                                   !2, ~22
   25    36        INIT_FCALL                                               'number_format'
         37        SEND_VAR                                                 !2
         38        SEND_VAL                                                 3
         39        DO_ICALL                                         $24     
         40        CONCAT                                           ~25     'explicit+foreach+', $24
         41        CONCAT                                           ~26     ~25, '+seconds+and+returned+'
         42        COUNT                                            ~27     !3
         43        CONCAT                                           ~28     ~26, ~27
         44        CONCAT                                           ~29     ~28, '+entries%0A'
         45        ECHO                                                     ~29
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.38 ms | 1392 KiB | 17 Q