3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); for ($i = 0; $i < 200000; $i++) { $a[] = array( 'name' => 'John', 'city' => 'New York', 'age' => $i % 200 == 0 ? 21 : 28 ); } $time = microtime(true); $filtered = array_filter($a, function ($item) { return ($item['age'] == 21); }); $time = microtime(true) - $time; echo 'closure 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/Q3TEW
function name:  (null)
number of ops:  43
compiled vars:  !0 = $a, !1 = $i, !2 = $time, !3 = $filtered
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                                       ~7      'John', 'name'
    9     4        ADD_ARRAY_ELEMENT                                ~7      'New+York', 'city'
   10     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'
    7    12        ASSIGN_DIM                                               !0
   10    13        OP_DATA                                                  ~7
    5    14        PRE_INC                                                  !1
         15    >   IS_SMALLER                                               !1, 200000
         16      > JMPNZ                                                    ~12, ->3
   14    17    >   INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !2, $13
   16    21        INIT_FCALL                                               'array_filter'
         22        SEND_VAR                                                 !0
         23        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FQ3TEW%3A16%240'
   18    24        SEND_VAL                                                 ~15
         25        DO_ICALL                                         $16     
   16    26        ASSIGN                                                   !3, $16
   20    27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $18     
         30        SUB                                              ~19     $18, !2
         31        ASSIGN                                                   !2, ~19
   22    32        INIT_FCALL                                               'number_format'
         33        SEND_VAR                                                 !2
         34        SEND_VAL                                                 3
         35        DO_ICALL                                         $21     
         36        CONCAT                                           ~22     'closure+took+', $21
         37        CONCAT                                           ~23     ~22, '+seconds+and+returned+'
         38        COUNT                                            ~24     !3
         39        CONCAT                                           ~25     ~23, ~24
         40        CONCAT                                           ~26     ~25, '+entries%0A'
         41        ECHO                                                     ~26
         42      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FQ3TEW%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q3TEW
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        FETCH_DIM_R                                      ~1      !0, 'age'
          2        IS_EQUAL                                         ~2      ~1, 21
          3      > RETURN                                                   ~2
   18     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FQ3TEW%3A16%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.52 ms | 1400 KiB | 19 Q