3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aTest = array('apple', 'pineapple', 'banana', 'kiwi', 'pear', 'strawberry', '1234', '#qwerty'); $range = range('A','Z') + array('#'); $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 = 9, Position 2 = 27
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 27
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 25
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 25
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 24
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 25
Branch analysis from position: 27
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 44
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 44
Branch analysis from position: 30
2 jumps found. (Code = 77) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
2 jumps found. (Code = 78) Position 1 = 38, Position 2 = 41
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 41
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
Branch analysis from position: 27
filename:       /in/AQgaN
function name:  (null)
number of ops:  46
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        ADD                                              ~10     $9, <array>
          6        ASSIGN                                                   !1, ~10
    6     7        ASSIGN                                                   !2, <array>
    8     8      > FE_RESET_R                                       $13     !1, ->27
          9    > > FE_FETCH_R                                               $13, !3, ->27
    9    10    > > FE_RESET_R                                       $14     !0, ->25
         11    > > FE_FETCH_R                                               $14, !4, ->25
   10    12    >   INIT_FCALL                                               'ucfirst'
         13        FETCH_DIM_R                                      ~15     !4, 0
         14        SEND_VAL                                                 ~15
         15        DO_ICALL                                         $16     
         16        IS_EQUAL                                                 !3, $16
         17      > JMPZ                                                     ~17, ->24
   11    18    >   INIT_FCALL                                               'ucfirst'
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                         $20     
         21        FETCH_DIM_W                                      $18     !2, !3
         22        ASSIGN_DIM                                               $18
         23        OP_DATA                                                  $20
    9    24    > > JMP                                                      ->11
         25    >   FE_FREE                                                  $14
    8    26      > JMP                                                      ->9
         27    >   FE_FREE                                                  $13
   16    28      > FE_RESET_R                                       $21     !2, ->44
         29    > > FE_FETCH_R                                       ~22     $21, !5, ->44
         30    >   ASSIGN                                                   !6, ~22
   17    31        CONCAT                                           ~24     !6, '%3Cbr%2F%3E--------%3Cbr%2F%3E%0A'
         32        ECHO                                                     ~24
   18    33        INIT_FCALL                                               'sort'
         34        SEND_REF                                                 !5
         35        DO_ICALL                                                 
   19    36      > FE_RESET_R                                       $26     !5, ->41
         37    > > FE_FETCH_R                                               $26, !7, ->41
   20    38    >   CONCAT                                           ~27     !7, '%3Cbr%2F%3E%0A'
         39        ECHO                                                     ~27
   19    40      > JMP                                                      ->37
         41    >   FE_FREE                                                  $26
   22    42        ECHO                                                     '%3Cbr%2F%3E%0A'
   16    43      > JMP                                                      ->29
         44    >   FE_FREE                                                  $21
   24    45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.28 ms | 1400 KiB | 19 Q