3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = json_decode('[{ "manufacturer": "KInd", "brand": "ABC", "used": "true" }, { "manufacturer": "KInd", "brand": "ABC", "used": "true" }, { "manufacturer": "KInd", "brand": "ABC", "used": "false" }]', true); $result = []; foreach ($array as $row) { $compositeKey = implode('_', $row); if (!isset($result[$compositeKey])) { $result[$compositeKey] = $row + ['count' => 1]; } else { ++$result[$compositeKey]['count']; } } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 21
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 21
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/mB8AJ
function name:  (null)
number of ops:  29
compiled vars:  !0 = $array, !1 = $result, !2 = $row, !3 = $compositeKey
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'json_decode'
          1        SEND_VAL                                                     '%5B%7B%0A++++%22manufacturer%22%3A+%22KInd%22%2C%0A++++%22brand%22%3A+%22ABC%22%2C%0A++++%22used%22%3A+%22true%22%0A%7D%2C%0A%7B%0A++++%22manufacturer%22%3A+%22KInd%22%2C%0A++++%22brand%22%3A+%22ABC%22%2C%0A++++%22used%22%3A+%22true%22%0A%7D%2C%0A%7B%0A++++%22manufacturer%22%3A+%22KInd%22%2C%0A++++%22brand%22%3A+%22ABC%22%2C%0A++++%22used%22%3A+%22false%22%0A%7D%5D'
   17     2        SEND_VAL                                                     <true>
    3     3        DO_ICALL                                             $4      
          4        ASSIGN                                                       !0, $4
   19     5        ASSIGN                                                       !1, <array>
   20     6      > FE_RESET_R                                           $7      !0, ->21
          7    > > FE_FETCH_R                                                   $7, !2, ->21
   21     8    >   FRAMELESS_ICALL_2                implode             ~8      '_', !2
          9        ASSIGN                                                       !3, ~8
   22    10        ISSET_ISEMPTY_DIM_OBJ                             0  ~10     !1, !3
         11        BOOL_NOT                                             ~11     ~10
         12      > JMPZ                                                         ~11, ->17
   23    13    >   ADD                                                  ~13     !2, <array>
         14        ASSIGN_DIM                                                   !1, !3
         15        OP_DATA                                                      ~13
   22    16      > JMP                                                          ->20
   25    17    >   FETCH_DIM_RW                                         $14     !1, !3
         18        FETCH_DIM_RW                                         $15     $14, 'count'
         19        PRE_INC                                                      $15
   20    20    > > JMP                                                          ->7
         21    >   FE_FREE                                                      $7
   28    22        INIT_FCALL                                                   'var_export'
         23        INIT_FCALL                                                   'array_values'
         24        SEND_VAR                                                     !1
         25        DO_ICALL                                             $17     
         26        SEND_VAR                                                     $17
         27        DO_ICALL                                                     
         28      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.72 ms | 1906 KiB | 16 Q