3v4l.org

run code in 300+ PHP versions simultaneously
<?php function agefilter($item) { return ($item['age'] == 21); } $a = array(); for ($i = 0; $i < 2000; $i++) { $a[] = array( 'name' => 'John', 'city' => 'New York', 'age' => $i % 200 == 0 ? 21 : 28 ); } $time = microtime(true); $filtered = array_filter($a, 'agefilter'); $time = microtime(true) - $time; echo 'callback took ' . 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
1 jumps found. (Code = 62) Position 1 = -2
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/aq1ah
function name:  (null)
number of ops:  42
compiled vars:  !0 = $a, !1 = $i, !2 = $time, !3 = $filtered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->15
   13     3    >   INIT_ARRAY                                       ~7      'John', 'name'
   14     4        ADD_ARRAY_ELEMENT                                ~7      'New+York', 'city'
   15     5        MOD                                              ~8      !1, 200
          6        IS_EQUAL                                                 ~8, 0
          7      > JMPZ                                                     ~9, ->10
          8    >   QM_ASSIGN                                        ~10     21
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~10     28
         11    >   ADD_ARRAY_ELEMENT                                ~7      ~10, 'age'
   12    12        ASSIGN_DIM                                               !0
   15    13        OP_DATA                                                  ~7
   10    14        PRE_INC                                                  !1
         15    >   IS_SMALLER                                               !1, 2000
         16      > JMPNZ                                                    ~12, ->3
   19    17    >   INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !2, $13
   21    21        INIT_FCALL                                               'array_filter'
         22        SEND_VAR                                                 !0
         23        SEND_VAL                                                 'agefilter'
         24        DO_ICALL                                         $15     
         25        ASSIGN                                                   !3, $15
   23    26        INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $17     
         29        SUB                                              ~18     $17, !2
         30        ASSIGN                                                   !2, ~18
   25    31        INIT_FCALL                                               'number_format'
         32        SEND_VAR                                                 !2
         33        SEND_VAL                                                 3
         34        DO_ICALL                                         $20     
         35        CONCAT                                           ~21     'callback+took+', $20
         36        CONCAT                                           ~22     ~21, '+seconds+and+returned+'
         37        COUNT                                            ~23     !3
         38        CONCAT                                           ~24     ~22, ~23
         39        CONCAT                                           ~25     ~24, '+entries%0A'
         40        ECHO                                                     ~25
         41      > RETURN                                                   1

Function agefilter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aq1ah
function name:  agefilter
number of ops:  5
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        FETCH_DIM_R                                      ~1      !0, 'age'
          2        IS_EQUAL                                         ~2      ~1, 21
          3      > RETURN                                                   ~2
    6     4*     > RETURN                                                   null

End of function agefilter

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.54 ms | 1400 KiB | 19 Q