3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '1-2' => 'stuff', '3-4' => 'otherstuff', '2-1' => 'morestuff', '5-6' => 'evenmorestuff', '6-5' => 'evenmorestuffagain' ]; $result = array_unique(array_map(function ($key) { $parts = explode('-', $key); sort($parts); return implode('-', $parts); }, array_keys($array))); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fr1qD
function name:  (null)
number of ops:  17
compiled vars:  !0 = $array, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'array_unique'
          2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
   15     4        SEND_VAL                                                 ~3
          5        INIT_FCALL                                               'array_keys'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
   11     9        DO_ICALL                                         $5      
   15    10        SEND_VAR                                                 $5
   11    11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !1, $6
   17    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
         16      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fr1qD
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $key, !1 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '-'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
   13     6        INIT_FCALL                                               'sort'
          7        SEND_REF                                                 !1
          8        DO_ICALL                                                 
   14     9        INIT_FCALL                                               'implode'
         10        SEND_VAL                                                 '-'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $5      
         13      > RETURN                                                   $5
   15    14*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.3 ms | 1005 KiB | 20 Q