3v4l.org

run code in 300+ 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:  34
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        INIT_FCALL                                               'implode'
         14        SEND_VAL                                                 '%2C'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                         $9      
         19        SEND_VAR                                                 $9
         20        DO_ICALL                                         $10     
         21        SEND_VAR                                                 $10
         22        DO_ICALL                                         $11     
         23        ASSIGN                                                   !2, $11
   15    24        INIT_FCALL                                               'sort'
         25        SEND_REF                                                 !2
         26        DO_ICALL                                                 
   16    27        INIT_FCALL                                               'implode'
         28        SEND_VAL                                                 '%2C'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                         $14     
         31        ASSIGN                                                   !3, $14
   17    32        ECHO                                                     !3
   18    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
214.34 ms | 1396 KiB | 23 Q