3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'background1.png - abc1.png','background1.png - abc2.png', 'background1.png - abc3.png','background2.png - abc4.png', 'background2.png - abc5.png','background2.png - abc6.png'); foreach ($arr as $elem) { $temp = explode('-', $elem); $key = trim($temp[0]); $fruits[$key][] = trim($temp[1]); } echo '<pre>';print_r($fruits);echo '</pre>';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 21
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/tP602
function name:  (null)
number of ops:  28
compiled vars:  !0 = $arr, !1 = $elem, !2 = $temp, !3 = $key, !4 = $fruits
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    7     1      > FE_RESET_R                                       $6      !0, ->21
          2    > > FE_FETCH_R                                               $6, !1, ->21
    8     3    >   INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '-'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !2, $7
    9     8        INIT_FCALL                                               'trim'
          9        FETCH_DIM_R                                      ~9      !2, 0
         10        SEND_VAL                                                 ~9
         11        DO_ICALL                                         $10     
         12        ASSIGN                                                   !3, $10
   10    13        INIT_FCALL                                               'trim'
         14        FETCH_DIM_R                                      ~14     !2, 1
         15        SEND_VAL                                                 ~14
         16        DO_ICALL                                         $15     
         17        FETCH_DIM_W                                      $12     !4, !3
         18        ASSIGN_DIM                                               $12
         19        OP_DATA                                                  $15
    7    20      > JMP                                                      ->2
         21    >   FE_FREE                                                  $6
   13    22        ECHO                                                     '%3Cpre%3E'
         23        INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !4
         25        DO_ICALL                                                 
         26        ECHO                                                     '%3C%2Fpre%3E'
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.56 ms | 1395 KiB | 19 Q