3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = ['A[1]', 'B[2]', 'C[2]', 'D[2]']; $b = ['B[3]', 'C[4]', 'E[4]', 'F[2]', 'G[2]']; $result = []; foreach ($a as $v) { $result[strtok($v, '[')] = $v; } foreach ($b as $v) { $result[strtok($v, '[')] = $v; } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 12
filename:       /in/3B07o
function name:  (null)
number of ops:  30
compiled vars:  !0 = $a, !1 = $b, !2 = $result, !3 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, <array>
    7     3      > FE_RESET_R                                       $7      !0, ->12
          4    > > FE_FETCH_R                                               $7, !3, ->12
    8     5    >   INIT_FCALL                                               'strtok'
          6        SEND_VAR                                                 !3
          7        SEND_VAL                                                 '%5B'
          8        DO_ICALL                                         $8      
          9        ASSIGN_DIM                                               !2, $8
         10        OP_DATA                                                  !3
    7    11      > JMP                                                      ->4
         12    >   FE_FREE                                                  $7
   10    13      > FE_RESET_R                                       $10     !1, ->22
         14    > > FE_FETCH_R                                               $10, !3, ->22
   11    15    >   INIT_FCALL                                               'strtok'
         16        SEND_VAR                                                 !3
         17        SEND_VAL                                                 '%5B'
         18        DO_ICALL                                         $11     
         19        ASSIGN_DIM                                               !2, $11
         20        OP_DATA                                                  !3
   10    21      > JMP                                                      ->14
         22    >   FE_FREE                                                  $10
   13    23        INIT_FCALL                                               'var_export'
         24        INIT_FCALL                                               'array_values'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $13     
         27        SEND_VAR                                                 $13
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.43 ms | 1003 KiB | 16 Q