3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aTest = array('apple', 'pineapple', 'banana', 'kiwi', 'pear', 'strawberry', '1234', '#qwerty'); $range = range('A','Z'); $range[] = '#'; $output = array(); foreach($range AS $letters){ foreach($aTest AS $fruit){ if(ucfirst($fruit[0]) == $letters){ $output[$letters][] = ucfirst($fruit); } } } foreach($output AS $letter => $fruits){ echo $letter . "<br/>--------<br/>\n"; sort($fruits); foreach($fruits AS $indFruit){ echo $indFruit . "<br/>\n"; } echo "<br/>\n"; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 28
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 28
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 26
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 26
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 25
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 25
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 26
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 30, Position 2 = 45
Branch analysis from position: 30
2 jumps found. (Code = 78) Position 1 = 31, Position 2 = 45
Branch analysis from position: 31
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 42
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 42
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 42
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
Branch analysis from position: 28
filename:       /in/4DjbE
function name:  (null)
number of ops:  47
compiled vars:  !0 = $aTest, !1 = $range, !2 = $output, !3 = $letters, !4 = $fruit, !5 = $fruits, !6 = $letter, !7 = $indFruit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 'A'
          3        SEND_VAL                                                 'Z'
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !1, $9
    5     6        ASSIGN_DIM                                               !1
          7        OP_DATA                                                  '%23'
    7     8        ASSIGN                                                   !2, <array>
    9     9      > FE_RESET_R                                       $13     !1, ->28
         10    > > FE_FETCH_R                                               $13, !3, ->28
   10    11    > > FE_RESET_R                                       $14     !0, ->26
         12    > > FE_FETCH_R                                               $14, !4, ->26
   11    13    >   INIT_FCALL                                               'ucfirst'
         14        FETCH_DIM_R                                      ~15     !4, 0
         15        SEND_VAL                                                 ~15
         16        DO_ICALL                                         $16     
         17        IS_EQUAL                                                 !3, $16
         18      > JMPZ                                                     ~17, ->25
   12    19    >   INIT_FCALL                                               'ucfirst'
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                         $20     
         22        FETCH_DIM_W                                      $18     !2, !3
         23        ASSIGN_DIM                                               $18
         24        OP_DATA                                                  $20
   10    25    > > JMP                                                      ->12
         26    >   FE_FREE                                                  $14
    9    27      > JMP                                                      ->10
         28    >   FE_FREE                                                  $13
   17    29      > FE_RESET_R                                       $21     !2, ->45
         30    > > FE_FETCH_R                                       ~22     $21, !5, ->45
         31    >   ASSIGN                                                   !6, ~22
   18    32        CONCAT                                           ~24     !6, '%3Cbr%2F%3E--------%3Cbr%2F%3E%0A'
         33        ECHO                                                     ~24
   19    34        INIT_FCALL                                               'sort'
         35        SEND_REF                                                 !5
         36        DO_ICALL                                                 
   20    37      > FE_RESET_R                                       $26     !5, ->42
         38    > > FE_FETCH_R                                               $26, !7, ->42
   21    39    >   CONCAT                                           ~27     !7, '%3Cbr%2F%3E%0A'
         40        ECHO                                                     ~27
   20    41      > JMP                                                      ->38
         42    >   FE_FREE                                                  $26
   23    43        ECHO                                                     '%3Cbr%2F%3E%0A'
   17    44      > JMP                                                      ->30
         45    >   FE_FREE                                                  $21
   25    46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.28 ms | 1400 KiB | 19 Q