3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen($count){ $a= []; for ($i = 0;$i < $count;$i++){ $a[$i] = mt_rand(0, 1000000); } return $a; } //Генерируем конфиг с 1000 игроками $config = gen(1000); arsort($config); //Способ 1 $x = microtime( true ); // Для замера времени for ($p = 0; $p < 1000; $p++) {// Выполняем это код много раз чтобы увеличить цифру $name = []; $money = []; foreach($config as $n => $m){ array_push($name, $n); array_push($money, $m); } } $x = microtime( true ) - $x; echo "Sposob 1: $x sekund za 1000 raz<br>"; //Способ 2 $x = microtime( true ); // Для замера времени for ($p = 0; $p < 1000; $p++) {// Выполняем это код много раз чтобы увеличить цифру $name = []; $money = []; reset($config); for($i = 0;$i < 5 && current($config);$i++){ $name[]=key($config); $money[]=current($config); next($config); } } $x = microtime( true ) - $x; echo "Sposob 2: $x sekund za 1000 raz<br>";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 13
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 46
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
2 jumps found. (Code = 46) Position 1 = 69, Position 2 = 73
Branch analysis from position: 69
2 jumps found. (Code = 44) Position 1 = 74, Position 2 = 53
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 46
Branch analysis from position: 77
Branch analysis from position: 46
Branch analysis from position: 53
2 jumps found. (Code = 46) Position 1 = 69, Position 2 = 73
Branch analysis from position: 69
Branch analysis from position: 73
Branch analysis from position: 73
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 27
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 13
Branch analysis from position: 31
Branch analysis from position: 13
Branch analysis from position: 27
filename:       /in/9TFtu
function name:  (null)
number of ops:  87
compiled vars:  !0 = $config, !1 = $x, !2 = $p, !3 = $name, !4 = $money, !5 = $m, !6 = $n, !7 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'gen'
          1        SEND_VAL                                                 1000
          2        DO_FCALL                                      0  $8      
          3        ASSIGN                                                   !0, $8
   13     4        INIT_FCALL                                               'arsort'
          5        SEND_REF                                                 !0
          6        DO_ICALL                                                 
   16     7        INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $11     
         10        ASSIGN                                                   !1, $11
   18    11        ASSIGN                                                   !2, 0
         12      > JMP                                                      ->29
   19    13    >   ASSIGN                                                   !3, <array>
   20    14        ASSIGN                                                   !4, <array>
   21    15      > FE_RESET_R                                       $16     !0, ->27
         16    > > FE_FETCH_R                                       ~17     $16, !5, ->27
         17    >   ASSIGN                                                   !6, ~17
   22    18        INIT_FCALL                                               'array_push'
         19        SEND_REF                                                 !3
         20        SEND_VAR                                                 !6
         21        DO_ICALL                                                 
   23    22        INIT_FCALL                                               'array_push'
         23        SEND_REF                                                 !4
         24        SEND_VAR                                                 !5
         25        DO_ICALL                                                 
   21    26      > JMP                                                      ->16
         27    >   FE_FREE                                                  $16
   18    28        PRE_INC                                                  !2
         29    >   IS_SMALLER                                               !2, 1000
         30      > JMPNZ                                                    ~22, ->13
   27    31    >   INIT_FCALL                                               'microtime'
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $23     
         34        SUB                                              ~24     $23, !1
         35        ASSIGN                                                   !1, ~24
   28    36        ROPE_INIT                                     3  ~27     'Sposob+1%3A+'
         37        ROPE_ADD                                      1  ~27     ~27, !1
         38        ROPE_END                                      2  ~26     ~27, '+sekund+za+1000+raz%3Cbr%3E'
         39        ECHO                                                     ~26
   31    40        INIT_FCALL                                               'microtime'
         41        SEND_VAL                                                 <true>
         42        DO_ICALL                                         $29     
         43        ASSIGN                                                   !1, $29
   33    44        ASSIGN                                                   !2, 0
         45      > JMP                                                      ->75
   34    46    >   ASSIGN                                                   !3, <array>
   35    47        ASSIGN                                                   !4, <array>
   36    48        INIT_FCALL                                               'reset'
         49        SEND_REF                                                 !0
         50        DO_ICALL                                                 
   37    51        ASSIGN                                                   !7, 0
         52      > JMP                                                      ->67
   38    53    >   INIT_FCALL                                               'key'
         54        SEND_VAR                                                 !0
         55        DO_ICALL                                         $37     
         56        ASSIGN_DIM                                               !3
         57        OP_DATA                                                  $37
   39    58        INIT_FCALL                                               'current'
         59        SEND_VAR                                                 !0
         60        DO_ICALL                                         $39     
         61        ASSIGN_DIM                                               !4
         62        OP_DATA                                                  $39
   40    63        INIT_FCALL                                               'next'
         64        SEND_REF                                                 !0
         65        DO_ICALL                                                 
   37    66        PRE_INC                                                  !7
         67    >   IS_SMALLER                                       ~42     !7, 5
         68      > JMPZ_EX                                          ~42     ~42, ->73
         69    >   INIT_FCALL                                               'current'
         70        SEND_VAR                                                 !0
         71        DO_ICALL                                         $43     
         72        BOOL                                             ~42     $43
         73    > > JMPNZ                                                    ~42, ->53
   33    74    >   PRE_INC                                                  !2
         75    >   IS_SMALLER                                               !2, 1000
         76      > JMPNZ                                                    ~45, ->46
   44    77    >   INIT_FCALL                                               'microtime'
         78        SEND_VAL                                                 <true>
         79        DO_ICALL                                         $46     
         80        SUB                                              ~47     $46, !1
         81        ASSIGN                                                   !1, ~47
   45    82        ROPE_INIT                                     3  ~50     'Sposob+2%3A+'
         83        ROPE_ADD                                      1  ~50     ~50, !1
         84        ROPE_END                                      2  ~49     ~50, '+sekund+za+1000+raz%3Cbr%3E'
         85        ECHO                                                     ~49
         86      > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
Branch analysis from position: 4
filename:       /in/9TFtu
function name:  gen
number of ops:  15
compiled vars:  !0 = $count, !1 = $a, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->11
    6     4    >   INIT_FCALL                                               'mt_rand'
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 1000000
          7        DO_ICALL                                         $6      
          8        ASSIGN_DIM                                               !1, !2
          9        OP_DATA                                                  $6
    5    10        PRE_INC                                                  !2
         11    >   IS_SMALLER                                               !2, !0
         12      > JMPNZ                                                    ~8, ->4
    8    13    > > RETURN                                                   !1
    9    14*     > RETURN                                                   null

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.13 ms | 1407 KiB | 30 Q