3v4l.org

run code in 500+ PHP versions simultaneously
<?php $rows = [['size' => 'XL,L,XXL'], ['size' => 'XL'], ['size' => 'M,L,XL'], ['size' => 'L,XL,M']]; // while ($srow = $result->fetch_assoc()) { foreach ($rows as $srow) { $sizes[] = $srow['size']; // do other stuff with fetched data // ... } $sizes = array_unique(array_map('trim', explode(',', implode(',', $sizes)))); sort($sizes); $string = implode(',', $sizes); echo $string;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/5DuRZ
function name:  (null)
number of ops:  28
compiled vars:  !0 = $rows, !1 = $srow, !2 = $sizes, !3 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    9     1      > FE_RESET_R                                           $5      !0, ->7
          2    > > FE_FETCH_R                                                   $5, !1, ->7
   10     3    >   FETCH_DIM_R                                          ~7      !1, 'size'
          4        ASSIGN_DIM                                                   !2
          5        OP_DATA                                                      ~7
    9     6      > JMP                                                          ->2
          7    >   FE_FREE                                                      $5
   14     8        INIT_FCALL                                                   'array_unique'
          9        INIT_FCALL                                                   'array_map'
         10        SEND_VAL                                                     'trim'
         11        INIT_FCALL                                                   'explode'
         12        SEND_VAL                                                     '%2C'
         13        FRAMELESS_ICALL_2                implode             ~8      '%2C', !2
         14        SEND_VAL                                                     ~8
         15        DO_ICALL                                             $9      
         16        SEND_VAR                                                     $9
         17        DO_ICALL                                             $10     
         18        SEND_VAR                                                     $10
         19        DO_ICALL                                             $11     
         20        ASSIGN                                                       !2, $11
   15    21        INIT_FCALL                                                   'sort'
         22        SEND_REF                                                     !2
         23        DO_ICALL                                                     
   16    24        FRAMELESS_ICALL_2                implode             ~14     '%2C', !2
         25        ASSIGN                                                       !3, ~14
   17    26        ECHO                                                         !3
   18    27      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.17 ms | 2096 KiB | 17 Q