3v4l.org

run code in 300+ PHP versions simultaneously
<?php $details = ["Dog" => "Natahlia", "Cat" => "Ryan", "Bird" => "Natahlia"]; foreach(array_unique($details) as $name){ $new[$name] = array_keys(array_intersect($details, [$name])); } var_dump($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/paYRJ
function name:  (null)
number of ops:  22
compiled vars:  !0 = $details, !1 = $name, !2 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1        INIT_FCALL                                               'array_unique'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4      > FE_RESET_R                                       $5      $4, ->17
          5    > > FE_FETCH_R                                               $5, !1, ->17
    7     6    >   INIT_FCALL                                               'array_keys'
          7        INIT_FCALL                                               'array_intersect'
          8        SEND_VAR                                                 !0
          9        INIT_ARRAY                                       ~7      !1
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                         $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                         $9      
         14        ASSIGN_DIM                                               !2, !1
         15        OP_DATA                                                  $9
    6    16      > JMP                                                      ->5
         17    >   FE_FREE                                                  $5
    9    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.78 ms | 1399 KiB | 21 Q