3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = microtime(true); $a = [ 'hallo welt', ' asss ', 'adasd13e1 123w1 23w123w21', '1232', '1231245rt235491340921830', '41904e09218i3219ß21093ß02193ß0219ß0', '2135r423', '!2242321', '21421421', '44', '1', '12435r2390ß4038i12ß2190ßi2ß10', ]; $a = array_filter($a, function($value) { return strlen($value) <= 10; }); $b = 5; $s = 10; $a = array_slice($a, 0, $b); $a = array_combine( range($s, $b*$s , $s), $a); var_dump( $a, microtime(true)-$start ); $start = microtime(true); $a = [ 'hatlo welt', ' asss ', 'adasd13e1 123w1 23w123w21', '1232', '1231245rt235491340921830', '41904e09218i3219ß21093ß02193ß0219ß0', '2135r423', '!2242321', '21421421', '44', '1', '12435r2390ß4038i12ß2190ßi2ß10', ]; $i = 0; $result =[]; foreach ($a as $bullet_point) { if (strlen($bullet_point) > 10 ) { continue; } $i+=1; $sort = $i * $s; $result[$sort] = $bullet_point; if ($i == $b) { break; } } if ($i < 0) { return false; } var_dump($result, microtime(true)-$start );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 46, Position 2 = 60
Branch analysis from position: 46
2 jumps found. (Code = 78) Position 1 = 47, Position 2 = 60
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 51
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 59
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 64
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 60
Branch analysis from position: 60
filename:       /in/MYlZo
function name:  (null)
number of ops:  73
compiled vars:  !0 = $start, !1 = $a, !2 = $b, !3 = $s, !4 = $i, !5 = $result, !6 = $bullet_point, !7 = $sort
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $8      
          3        ASSIGN                                                   !0, $8
    7     4        ASSIGN                                                   !1, <array>
   23     5        INIT_FCALL                                               'array_filter'
          6        SEND_VAR                                                 !1
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMYlZo%3A23%240'
   25     8        SEND_VAL                                                 ~11
          9        DO_ICALL                                         $12     
   23    10        ASSIGN                                                   !1, $12
   27    11        ASSIGN                                                   !2, 5
   28    12        ASSIGN                                                   !3, 10
   30    13        INIT_FCALL                                               'array_slice'
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 0
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                         $16     
         18        ASSIGN                                                   !1, $16
   31    19        INIT_FCALL                                               'array_combine'
         20        INIT_FCALL                                               'range'
         21        SEND_VAR                                                 !3
         22        MUL                                              ~18     !2, !3
         23        SEND_VAL                                                 ~18
         24        SEND_VAR                                                 !3
         25        DO_ICALL                                         $19     
         26        SEND_VAR                                                 $19
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                         $20     
         29        ASSIGN                                                   !1, $20
   33    30        INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !1
         32        INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $22     
         35        SUB                                              ~23     $22, !0
         36        SEND_VAL                                                 ~23
         37        DO_ICALL                                                 
   35    38        INIT_FCALL                                               'microtime'
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $25     
         41        ASSIGN                                                   !0, $25
   37    42        ASSIGN                                                   !1, <array>
   52    43        ASSIGN                                                   !4, 0
   53    44        ASSIGN                                                   !5, <array>
   54    45      > FE_RESET_R                                       $30     !1, ->60
         46    > > FE_FETCH_R                                               $30, !6, ->60
   55    47    >   STRLEN                                           ~31     !6
         48        IS_SMALLER                                               10, ~31
         49      > JMPZ                                                     ~32, ->51
   56    50    > > JMP                                                      ->46
   59    51    >   ASSIGN_OP                                     1          !4, 1
   60    52        MUL                                              ~34     !4, !3
         53        ASSIGN                                                   !7, ~34
   61    54        ASSIGN_DIM                                               !5, !7
         55        OP_DATA                                                  !6
   63    56        IS_EQUAL                                                 !4, !2
         57      > JMPZ                                                     ~37, ->59
   64    58    > > JMP                                                      ->60
   54    59    > > JMP                                                      ->46
         60    >   FE_FREE                                                  $30
   68    61        IS_SMALLER                                               !4, 0
         62      > JMPZ                                                     ~38, ->64
   69    63    > > RETURN                                                   <false>
   72    64    >   INIT_FCALL                                               'var_dump'
         65        SEND_VAR                                                 !5
         66        INIT_FCALL                                               'microtime'
         67        SEND_VAL                                                 <true>
         68        DO_ICALL                                         $39     
         69        SUB                                              ~40     $39, !0
         70        SEND_VAL                                                 ~40
         71        DO_ICALL                                                 
         72      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FMYlZo%3A23%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.58 ms | 1404 KiB | 25 Q