3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'); $start = microtime(true); for($k=0;$k<100;$k++) { $str = ltrim(strrev(chunk_split(implode(array_reverse($vars)), 3, ';')),';'); } $end = microtime(true); echo $end - $start; echo "\n\n"; $start = microtime(true); for($k=0;$k<100;$k++) { $size = sizeOf($vars); for ($i = $size-3; $i > 0; $i-=3) { array_splice($vars,$i,0,";"); } } $end = microtime(true); echo $end - $start; echo "\n\n"; $start = microtime(true); for($k=0;$k<100;$k++) { $array = array_reverse(range('a', 'h')); // reverse $array = array_chunk($array, 3); // cut by threes $string = ''; foreach ($array as $value) { $string .= implode($value); // glue them if(count($value) == 3) { // if still three, add a semi $string .= ';'; } } $string = strrev($string); // then reverse them again } $end = microtime(true); echo $end - $start;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 7
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 42
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 103
Branch analysis from position: 103
2 jumps found. (Code = 44) Position 1 = 105, Position 2 = 72
Branch analysis from position: 105
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
2 jumps found. (Code = 77) Position 1 = 87, Position 2 = 97
Branch analysis from position: 87
2 jumps found. (Code = 78) Position 1 = 88, Position 2 = 97
Branch analysis from position: 88
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 96
Branch analysis from position: 95
1 jumps found. (Code = 42) Position 1 = 87
Branch analysis from position: 87
Branch analysis from position: 96
Branch analysis from position: 97
2 jumps found. (Code = 44) Position 1 = 105, Position 2 = 72
Branch analysis from position: 105
Branch analysis from position: 72
Branch analysis from position: 97
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 47
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 42
Branch analysis from position: 59
Branch analysis from position: 42
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 47
Branch analysis from position: 56
Branch analysis from position: 47
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 7
Branch analysis from position: 29
Branch analysis from position: 7
filename:       /in/rBmui
function name:  (null)
number of ops:  112
compiled vars:  !0 = $vars, !1 = $start, !2 = $k, !3 = $str, !4 = $end, !5 = $size, !6 = $i, !7 = $array, !8 = $string, !9 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $11     
          4        ASSIGN                                                   !1, $11
    5     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->27
    6     7    >   INIT_FCALL                                               'ltrim'
          8        INIT_FCALL                                               'strrev'
          9        INIT_FCALL                                               'chunk_split'
         10        INIT_FCALL                                               'implode'
         11        INIT_FCALL                                               'array_reverse'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $14     
         14        SEND_VAR                                                 $14
         15        DO_ICALL                                         $15     
         16        SEND_VAR                                                 $15
         17        SEND_VAL                                                 3
         18        SEND_VAL                                                 '%3B'
         19        DO_ICALL                                         $16     
         20        SEND_VAR                                                 $16
         21        DO_ICALL                                         $17     
         22        SEND_VAR                                                 $17
         23        SEND_VAL                                                 '%3B'
         24        DO_ICALL                                         $18     
         25        ASSIGN                                                   !3, $18
    5    26        PRE_INC                                                  !2
         27    >   IS_SMALLER                                               !2, 100
         28      > JMPNZ                                                    ~21, ->7
    8    29    >   INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $22     
         32        ASSIGN                                                   !4, $22
    9    33        SUB                                              ~24     !4, !1
         34        ECHO                                                     ~24
   11    35        ECHO                                                     '%0A%0A'
   13    36        INIT_FCALL                                               'microtime'
         37        SEND_VAL                                                 <true>
         38        DO_ICALL                                         $25     
         39        ASSIGN                                                   !1, $25
   14    40        ASSIGN                                                   !2, 0
         41      > JMP                                                      ->57
   15    42    >   COUNT                                            ~28     !0
         43        ASSIGN                                                   !5, ~28
   16    44        SUB                                              ~30     !5, 3
         45        ASSIGN                                                   !6, ~30
         46      > JMP                                                      ->54
   17    47    >   INIT_FCALL                                               'array_splice'
         48        SEND_REF                                                 !0
         49        SEND_VAR                                                 !6
         50        SEND_VAL                                                 0
         51        SEND_VAL                                                 '%3B'
         52        DO_ICALL                                                 
   16    53        ASSIGN_OP                                     2          !6, 3
         54    >   IS_SMALLER                                               0, !6
         55      > JMPNZ                                                    ~34, ->47
   14    56    >   PRE_INC                                                  !2
         57    >   IS_SMALLER                                               !2, 100
         58      > JMPNZ                                                    ~36, ->42
   20    59    >   INIT_FCALL                                               'microtime'
         60        SEND_VAL                                                 <true>
         61        DO_ICALL                                         $37     
         62        ASSIGN                                                   !4, $37
   21    63        SUB                                              ~39     !4, !1
         64        ECHO                                                     ~39
   23    65        ECHO                                                     '%0A%0A'
   25    66        INIT_FCALL                                               'microtime'
         67        SEND_VAL                                                 <true>
         68        DO_ICALL                                         $40     
         69        ASSIGN                                                   !1, $40
   26    70        ASSIGN                                                   !2, 0
         71      > JMP                                                      ->103
   27    72    >   INIT_FCALL                                               'array_reverse'
         73        INIT_FCALL                                               'range'
         74        SEND_VAL                                                 'a'
         75        SEND_VAL                                                 'h'
         76        DO_ICALL                                         $43     
         77        SEND_VAR                                                 $43
         78        DO_ICALL                                         $44     
         79        ASSIGN                                                   !7, $44
   28    80        INIT_FCALL                                               'array_chunk'
         81        SEND_VAR                                                 !7
         82        SEND_VAL                                                 3
         83        DO_ICALL                                         $46     
         84        ASSIGN                                                   !7, $46
   29    85        ASSIGN                                                   !8, ''
   30    86      > FE_RESET_R                                       $49     !7, ->97
         87    > > FE_FETCH_R                                               $49, !9, ->97
   31    88    >   INIT_FCALL                                               'implode'
         89        SEND_VAR                                                 !9
         90        DO_ICALL                                         $50     
         91        ASSIGN_OP                                     8          !8, $50
   32    92        COUNT                                            ~52     !9
         93        IS_EQUAL                                                 ~52, 3
         94      > JMPZ                                                     ~53, ->96
   33    95    >   ASSIGN_OP                                     8          !8, '%3B'
   30    96    > > JMP                                                      ->87
         97    >   FE_FREE                                                  $49
   36    98        INIT_FCALL                                               'strrev'
         99        SEND_VAR                                                 !8
        100        DO_ICALL                                         $55     
        101        ASSIGN                                                   !8, $55
   26   102        PRE_INC                                                  !2
        103    >   IS_SMALLER                                               !2, 100
        104      > JMPNZ                                                    ~58, ->72
   38   105    >   INIT_FCALL                                               'microtime'
        106        SEND_VAL                                                 <true>
        107        DO_ICALL                                         $59     
        108        ASSIGN                                                   !4, $59
   39   109        SUB                                              ~61     !4, !1
        110        ECHO                                                     ~61
        111      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.1 ms | 1409 KiB | 31 Q