3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_uunique($rgData, $fnCompare=null) { if(!isset($fnCompare)) { return array_unique($rgData); } if(!is_callable($fnCompare)) { return null; } if(!count($rgData)) { return array(); } $rgResult = array(); foreach($rgData as $mItem) { foreach($rgResult as $mTest) { if(!call_user_func_array($fnCompare, [$mItem, $mTest])) { continue 2; } } $rgResult[]=$mItem; } return $rgResult; } $rgResult = array_uunique(['foo', 'feo', 'bee' , 'bar', 'baz'], function($x, $y) { return levenshtein($x, $y)>1; }); var_dump($rgResult);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vddF4
function name:  (null)
number of ops:  10
compiled vars:  !0 = $rgResult
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                               'array_uunique'
          1        SEND_VAL                                                 <array>
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FvddF4%3A32%240'
   35     3        SEND_VAL                                                 ~1
          4        DO_FCALL                                      0  $2      
   32     5        ASSIGN                                                   !0, $2
   36     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function array_uunique:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 39
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 39
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 35
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 35
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 35
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/vddF4
function name:  array_uunique
number of ops:  42
compiled vars:  !0 = $rgData, !1 = $fnCompare, !2 = $rgResult, !3 = $mItem, !4 = $mTest
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    4     2        ISSET_ISEMPTY_CV                                 ~5      !1
          3        BOOL_NOT                                         ~6      ~5
          4      > JMPZ                                                     ~6, ->9
    6     5    >   INIT_FCALL                                               'array_unique'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $7      
          8      > RETURN                                                   $7
    8     9    >   INIT_FCALL                                               'is_callable'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $8      
         12        BOOL_NOT                                         ~9      $8
         13      > JMPZ                                                     ~9, ->15
   10    14    > > RETURN                                                   null
   12    15    >   COUNT                                            ~10     !0
         16        BOOL_NOT                                         ~11     ~10
         17      > JMPZ                                                     ~11, ->19
   14    18    > > RETURN                                                   <array>
   16    19    >   ASSIGN                                                   !2, <array>
   17    20      > FE_RESET_R                                       $13     !0, ->39
         21    > > FE_FETCH_R                                               $13, !3, ->39
   19    22    > > FE_RESET_R                                       $14     !2, ->35
         23    > > FE_FETCH_R                                               $14, !4, ->35
   21    24    >   INIT_USER_CALL                                0          'call_user_func_array', !1
         25        INIT_ARRAY                                       ~15     !3
         26        ADD_ARRAY_ELEMENT                                ~15     !4
         27        SEND_ARRAY                                               ~15
         28        CHECK_UNDEF_ARGS                                         
         29        DO_FCALL                                      0  $16     
         30        BOOL_NOT                                         ~17     $16
         31      > JMPZ                                                     ~17, ->34
   23    32    >   FE_FREE                                                  $14
         33      > JMP                                                      ->21
   19    34    > > JMP                                                      ->23
         35    >   FE_FREE                                                  $14
   26    36        ASSIGN_DIM                                               !2
         37        OP_DATA                                                  !3
   17    38      > JMP                                                      ->21
         39    >   FE_FREE                                                  $13
   28    40      > RETURN                                                   !2
   29    41*     > RETURN                                                   null

End of function array_uunique

Function %00%7Bclosure%7D%2Fin%2FvddF4%3A32%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vddF4
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   34     2        INIT_FCALL                                               'levenshtein'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6        IS_SMALLER                                       ~3      1, $2
          7      > RETURN                                                   ~3
   35     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FvddF4%3A32%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.44 ms | 1403 KiB | 22 Q