3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "Rocket abc bla blub bla Rocket"; $textArr = explode(" ", $text); $wordCountArr = []; foreach ($textArr as $word) { if (!isset($wordCountArr[$word])) { $wordCountArr[$word] = 1; } else { $wordCountArr[$word]++; } } natcasesort($wordCountArr); $textOrderArr = $wordCountArr; $inversedArr = []; foreach ($textOrderArr as $word => $count) { $inversedArr[$count][] = $word; } krsort($inversedArr); foreach ($inversedArr as $count => $words) { foreach ($words as $word) { echo $count . " x " . $word; echo PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 31
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 47
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 47
Branch analysis from position: 37
2 jumps found. (Code = 77) Position 1 = 39, Position 2 = 45
Branch analysis from position: 39
2 jumps found. (Code = 78) Position 1 = 40, Position 2 = 45
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 45
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
Branch analysis from position: 31
Branch analysis from position: 18
filename:       /in/ngWD3
function name:  (null)
number of ops:  49
compiled vars:  !0 = $text, !1 = $textArr, !2 = $wordCountArr, !3 = $word, !4 = $textOrderArr, !5 = $inversedArr, !6 = $count, !7 = $words
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Rocket+abc+bla+blub+bla+Rocket'
    5     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !1, $9
    7     6        ASSIGN                                                   !2, <array>
    8     7      > FE_RESET_R                                       $12     !1, ->18
          8    > > FE_FETCH_R                                               $12, !3, ->18
    9     9    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~13     !2, !3
         10        BOOL_NOT                                         ~14     ~13
         11      > JMPZ                                                     ~14, ->15
   10    12    >   ASSIGN_DIM                                               !2, !3
         13        OP_DATA                                                  1
         14      > JMP                                                      ->17
   12    15    >   FETCH_DIM_RW                                     $16     !2, !3
         16        PRE_INC                                                  $16
    8    17    > > JMP                                                      ->8
         18    >   FE_FREE                                                  $12
   16    19        INIT_FCALL                                               'natcasesort'
         20        SEND_REF                                                 !2
         21        DO_ICALL                                                 
   17    22        ASSIGN                                                   !4, !2
   19    23        ASSIGN                                                   !5, <array>
   20    24      > FE_RESET_R                                       $21     !4, ->31
         25    > > FE_FETCH_R                                       ~22     $21, !6, ->31
         26    >   ASSIGN                                                   !3, ~22
   21    27        FETCH_DIM_W                                      $24     !5, !6
         28        ASSIGN_DIM                                               $24
         29        OP_DATA                                                  !3
   20    30      > JMP                                                      ->25
         31    >   FE_FREE                                                  $21
   24    32        INIT_FCALL                                               'krsort'
         33        SEND_REF                                                 !5
         34        DO_ICALL                                                 
   26    35      > FE_RESET_R                                       $27     !5, ->47
         36    > > FE_FETCH_R                                       ~28     $27, !7, ->47
         37    >   ASSIGN                                                   !6, ~28
   27    38      > FE_RESET_R                                       $30     !7, ->45
         39    > > FE_FETCH_R                                               $30, !3, ->45
   28    40    >   CONCAT                                           ~31     !6, '+x+'
         41        CONCAT                                           ~32     ~31, !3
         42        ECHO                                                     ~32
   29    43        ECHO                                                     '%0A'
   27    44      > JMP                                                      ->39
         45    >   FE_FREE                                                  $30
   26    46      > JMP                                                      ->36
         47    >   FE_FREE                                                  $27
   31    48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.26 ms | 1400 KiB | 19 Q