3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = json_decode('[ { "nsr": "000086310", "type": "3", "date": "2015-07-18", "time": "00:06", "pis": "12138790985" }, { "nsr": "000086313", "type": "3", "date": "2015-07-18", "time": "00:33", "pis": "16073736879" }, { "nsr": "000086316", "type": "3", "date": "2015-07-18", "time": "00:58", "pis": "16634402451" }, { "nsr": "000086316", "type": "3", "date": "2015-07-19", "time": "00:58", "pis": "98127981729" }, { "nsr": "000086316", "type": "3", "date": "2015-07-19", "time": "00:58", "pis": "12398712938" } ]', true); $result = []; foreach ($array as ['date' => $d, 'pis' => $p]) { if (!isset($ref[$d])) { $ref[$d] = ['date' => $d]; $result[] =& $ref[$d]; } $ref[$d]['pis'][] = $p; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 28
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 28
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 23
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/BLs8u
function name:  (null)
number of ops:  33
compiled vars:  !0 = $array, !1 = $result, !2 = $d, !3 = $p, !4 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%5B%0A+%7B%0A++%22nsr%22%3A+%22000086310%22%2C%0A++%22type%22%3A+%223%22%2C%0A++%22date%22%3A+%222015-07-18%22%2C%0A++%22time%22%3A+%2200%3A06%22%2C%0A++%22pis%22%3A+%2212138790985%22%0A+%7D%2C%0A+%7B%0A++%22nsr%22%3A+%22000086313%22%2C%0A++%22type%22%3A+%223%22%2C%0A++%22date%22%3A+%222015-07-18%22%2C%0A++%22time%22%3A+%2200%3A33%22%2C%0A++%22pis%22%3A+%2216073736879%22%0A+%7D%2C%0A+%7B%0A++%22nsr%22%3A+%22000086316%22%2C%0A++%22type%22%3A+%223%22%2C%0A++%22date%22%3A+%222015-07-18%22%2C%0A++%22time%22%3A+%2200%3A58%22%2C%0A++%22pis%22%3A+%2216634402451%22%0A+%7D%2C%0A+%7B%0A++%22nsr%22%3A+%22000086316%22%2C%0A++%22type%22%3A+%223%22%2C%0A++%22date%22%3A+%222015-07-19%22%2C%0A++%22time%22%3A+%2200%3A58%22%2C%0A++%22pis%22%3A+%2298127981729%22%0A+%7D%2C%0A+%7B%0A++%22nsr%22%3A+%22000086316%22%2C%0A++%22type%22%3A+%223%22%2C%0A++%22date%22%3A+%222015-07-19%22%2C%0A++%22time%22%3A+%2200%3A58%22%2C%0A++%22pis%22%3A+%2212398712938%22%0A+%7D%0A%5D'
   39     2        SEND_VAL                                                 <true>
    3     3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !0, $5
   41     5        ASSIGN                                                   !1, <array>
   42     6      > FE_RESET_R                                       $8      !0, ->28
          7    > > FE_FETCH_R                                               $8, $9, ->28
          8    >   FETCH_LIST_R                                     $10     $9, 'date'
          9        ASSIGN                                                   !2, $10
         10        FETCH_LIST_R                                     $12     $9, 'pis'
         11        ASSIGN                                                   !3, $12
         12        FREE                                                     $9
   43    13        ISSET_ISEMPTY_DIM_OBJ                         0  ~14     !4, !2
         14        BOOL_NOT                                         ~15     ~14
         15      > JMPZ                                                     ~15, ->23
   44    16    >   INIT_ARRAY                                       ~17     !2, 'date'
         17        ASSIGN_DIM                                               !4, !2
         18        OP_DATA                                                  ~17
   45    19        FETCH_DIM_W                                      $19     !4, !2
         20        MAKE_REF                                         $20     $19
         21        FETCH_DIM_W                                      $18     !1
         22        ASSIGN_REF                                               $18, $20
   47    23    >   FETCH_DIM_W                                      $22     !4, !2
         24        FETCH_DIM_W                                      $23     $22, 'pis'
         25        ASSIGN_DIM                                               $23
         26        OP_DATA                                                  !3
   42    27      > JMP                                                      ->7
         28    >   FE_FREE                                                  $8
   49    29        INIT_FCALL                                               'var_export'
         30        SEND_VAR                                                 !1
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.37 ms | 1004 KiB | 15 Q