3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'foo', 'foo', 'bar', 'baZ', 'baz', 'fÖo', 'foeo' ]; $collator = new Collator('en'); $collator->setStrength(Collator::PRIMARY); $arr2 = []; foreach ($arr as $v) { foreach ($arr2 as $v2) { if ($collator->compare($v, $v2) === 0) { continue 2; } } $arr2[] = $v; } var_dump($arr2);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 27
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 23
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 23
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/bE3LQ
function name:  (null)
number of ops:  32
compiled vars:  !0 = $arr, !1 = $collator, !2 = $arr2, !3 = $v, !4 = $v2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        NEW                                              $6      'Collator'
          2        SEND_VAL_EX                                              'en'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $6
   14     5        INIT_METHOD_CALL                                         !1, 'setStrength'
          6        FETCH_CLASS_CONSTANT                             ~9      'Collator', 'PRIMARY'
          7        SEND_VAL_EX                                              ~9
          8        DO_FCALL                                      0          
   16     9        ASSIGN                                                   !2, <array>
   17    10      > FE_RESET_R                                       $12     !0, ->27
         11    > > FE_FETCH_R                                               $12, !3, ->27
   18    12    > > FE_RESET_R                                       $13     !2, ->23
         13    > > FE_FETCH_R                                               $13, !4, ->23
   19    14    >   INIT_METHOD_CALL                                         !1, 'compare'
         15        SEND_VAR_EX                                              !3
         16        SEND_VAR_EX                                              !4
         17        DO_FCALL                                      0  $14     
         18        IS_IDENTICAL                                             $14, 0
         19      > JMPZ                                                     ~15, ->22
   20    20    >   FE_FREE                                                  $13
         21      > JMP                                                      ->11
   18    22    > > JMP                                                      ->13
         23    >   FE_FREE                                                  $13
   23    24        ASSIGN_DIM                                               !2
         25        OP_DATA                                                  !3
   17    26      > JMP                                                      ->11
         27    >   FE_FREE                                                  $12
   26    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.44 ms | 1388 KiB | 15 Q