3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aTest = array('apple', 'pineapple', 'banana', 'kiwi', 'pear', 'strawberry', '1234', '#qwerty', '!qwerty'); $range = range('A','Z'); $range[] = "#"; $output = array(); foreach($aTest AS $fruit){ $uc = ucfirst($fruit); if(array_search($uc[0], $range) === FALSE){ $output['#'][] = $uc; } else { $output[$uc[0]][] = $uc; } } print_r($output);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 31
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 31
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/a0tUO
function name:  (null)
number of ops:  36
compiled vars:  !0 = $aTest, !1 = $range, !2 = $output, !3 = $fruit, !4 = $uc
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                                         $6      
          5        ASSIGN                                                   !1, $6
    5     6        ASSIGN_DIM                                               !1
          7        OP_DATA                                                  '%23'
    6     8        ASSIGN                                                   !2, <array>
   10     9      > FE_RESET_R                                       $10     !0, ->31
         10    > > FE_FETCH_R                                               $10, !3, ->31
   11    11    >   INIT_FCALL                                               'ucfirst'
         12        SEND_VAR                                                 !3
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !4, $11
   12    15        INIT_FCALL                                               'array_search'
         16        FETCH_DIM_R                                      ~13     !4, 0
         17        SEND_VAL                                                 ~13
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $14     
         20        TYPE_CHECK                                    4          $14
         21      > JMPZ                                                     ~15, ->26
   13    22    >   FETCH_DIM_W                                      $16     !2, '%23'
         23        ASSIGN_DIM                                               $16
         24        OP_DATA                                                  !4
         25      > JMP                                                      ->30
   15    26    >   FETCH_DIM_R                                      ~18     !4, 0
         27        FETCH_DIM_W                                      $19     !2, ~18
         28        ASSIGN_DIM                                               $19
         29        OP_DATA                                                  !4
   10    30    > > JMP                                                      ->10
         31    >   FE_FREE                                                  $10
   19    32        INIT_FCALL                                               'print_r'
         33        SEND_VAR                                                 !2
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.41 ms | 1396 KiB | 21 Q