3v4l.org

run code in 300+ PHP versions simultaneously
<?php $food = Array ( 'Joe' => Array ( 0 => 'Pizza', 1 => 'Pasta', 2 => 'Lasagne', 3 => 'Tacos', 4 => 'Hamburger' ), 'Conny' => Array ( 0 => 'Pizza', 1 => 'Pasta', 2 => 'Lasagne', 3 => 'Tacos', 4 => 'Hamburger' ), 'John' => Array ( 0 => 'Pizza', 1 => 'Pasta' ), 'Fred' => Array ( 0 => 'Pizza', 1 => 'Pasta', 2 => 'Soup', 3 => 'Fish' ), 'Greg' => Array ( 0 => 'Sushi' ) ); uasort($food, function($a, $b) { return count($b) <=> count($a); }); $used = array(); foreach($food as $kl => $pl) { foreach($pl as $k => $p) { if(!in_array($p, $used)) { $used[] = $p; } else { unset($food[$kl][$k]); } } } $food = array_filter($food); var_dump($food);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 27
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 27
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 25
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 25
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
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 = 11
Branch analysis from position: 11
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 25
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/LjpGD
function name:  (null)
number of ops:  36
compiled vars:  !0 = $food, !1 = $used, !2 = $pl, !3 = $kl, !4 = $p, !5 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   42     1        INIT_FCALL                                               'uasort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLjpGD%3A42%240'
   44     4        SEND_VAL                                                 ~7
          5        DO_ICALL                                                 
   46     6        ASSIGN                                                   !1, <array>
   47     7      > FE_RESET_R                                       $10     !0, ->27
          8    > > FE_FETCH_R                                       ~11     $10, !2, ->27
          9    >   ASSIGN                                                   !3, ~11
   48    10      > FE_RESET_R                                       $13     !2, ->25
         11    > > FE_FETCH_R                                       ~14     $13, !4, ->25
         12    >   ASSIGN                                                   !5, ~14
   49    13        INIT_FCALL                                               'in_array'
         14        SEND_VAR                                                 !4
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $16     
         17        BOOL_NOT                                         ~17     $16
         18      > JMPZ                                                     ~17, ->22
   50    19    >   ASSIGN_DIM                                               !1
         20        OP_DATA                                                  !4
         21      > JMP                                                      ->24
   52    22    >   FETCH_DIM_UNSET                                  $19     !0, !3
         23        UNSET_DIM                                                $19, !5
   48    24    > > JMP                                                      ->11
         25    >   FE_FREE                                                  $13
   47    26      > JMP                                                      ->8
         27    >   FE_FREE                                                  $10
   56    28        INIT_FCALL                                               'array_filter'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                         $20     
         31        ASSIGN                                                   !0, $20
   57    32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FLjpGD%3A42%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LjpGD
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   43     2        COUNT                                            ~2      !1
          3        COUNT                                            ~3      !0
          4        SPACESHIP                                        ~4      ~2, ~3
          5      > RETURN                                                   ~4
   44     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLjpGD%3A42%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
131.34 ms | 1405 KiB | 21 Q