3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array( "0" => Array("CategoryID" => 3,"CategoryName" => "Test Category","Parent" => 0,"Thumb" => 0,"sort" => 8,"ArticleID" => 2,"ArticleCatgories" => "9,4,3","ArticleTitle" => "vxcvxcvx","ArticleBody" => "xcvxcvxcvxcv","InGroup" => 0,"GroupID" => 0,"Published" => 1,"PublishTime" => null,"TermID" => 11,"TermSlug" => "xcvxcvxcv","RelatedID" => 2,"TermType" => "article"), "1" => Array("CategoryID" => 4,"CategoryName" => "Test Image","Parent" => 0,"Thumb" => 0,"sort" => 4,"ArticleID" => 3,"ArticleCatgories" => "9,4,3","ArticleTitle" => "vxcvxcvx","ArticleBody" => "xcvxcvxcvxcv","InGroup" => 0,"GroupID" => 0,"Published" => 1,"PublishTime" => null,"TermID" => 11,"TermSlug" => "xcvxcvxcv","RelatedID" => 2,"TermType" => "article"), "2" => Array("CategoryID" => 9,"CategoryName" => "Test Images","Parent" => 0,"Thumb" => 7,"sort" => 2,"ArticleID" => 2,"ArticleCatgories" => "9,4,3","ArticleTitle" => "vxcvxcvx","ArticleBody" => "xcvxcvxcvxcv","InGroup" => 0,"GroupID" => 0,"Published" => 1,"PublishTime" => null,"TermID" => 11,"TermSlug" => "xcvxcvxcv","RelatedID" => 2,"TermType" => "article"), "3" => Array("CategoryID" => 4,"CategoryName" => "Test A","Parent" => 0,"Thumb" => 0,"sort" => 4,"ArticleID" => 3,"ArticleCatgories" => "9,4,3","ArticleTitle" => "vxcvxcvx","ArticleBody" => "xcvxcvxcvxcv","InGroup" => 0,"GroupID" => 0,"Published" => 1,"PublishTime" => null,"TermID" => 11,"TermSlug" => "xcvxcvxcv","RelatedID" => 2,"TermType" => "article"), "4" => Array("CategoryID" => 9,"CategoryName" => "Test B","Parent" => 0,"Thumb" => 7,"sort" => 2,"ArticleID" => 2,"ArticleCatgories" => "9,4,3","ArticleTitle" => "vxcvxcvx","ArticleBody" => "xcvxcvxcvxcv","InGroup" => 0,"GroupID" => 0,"Published" => 1,"PublishTime" => null,"TermID" => 11,"TermSlug" => "xcvxcvxcv","RelatedID" => 2,"TermType" => "article") ); $array = array_reduce( $array, function ($a, $b) { if (!isset($a[$b['ArticleID']])) { $a[$b['ArticleID']] = $b ; $a[$b['ArticleID']]['CategoryName'] = array($b['CategoryName']); } else { $a[$b['ArticleID']]['CategoryName'][] = $b['CategoryName']; } return $a; } ); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GKiZ1
function name:  (null)
number of ops:  11
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'array_reduce'
   12     2        SEND_VAR                                                 !0
   13     3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   21     4        SEND_VAL                                                 ~2
   11     5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !0, $3
   24     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GKiZ1
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        FETCH_DIM_R                                      ~2      !1, 'ArticleID'
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      !0, ~2
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->16
   15     6    >   FETCH_DIM_R                                      ~5      !1, 'ArticleID'
          7        ASSIGN_DIM                                               !0, ~5
          8        OP_DATA                                                  !1
   16     9        FETCH_DIM_R                                      ~7      !1, 'ArticleID'
         10        FETCH_DIM_R                                      ~10     !1, 'CategoryName'
         11        INIT_ARRAY                                       ~11     ~10
         12        FETCH_DIM_W                                      $8      !0, ~7
         13        ASSIGN_DIM                                               $8, 'CategoryName'
         14        OP_DATA                                                  ~11
   14    15      > JMP                                                      ->22
   18    16    >   FETCH_DIM_R                                      ~12     !1, 'ArticleID'
         17        FETCH_DIM_R                                      ~16     !1, 'CategoryName'
         18        FETCH_DIM_W                                      $13     !0, ~12
         19        FETCH_DIM_W                                      $14     $13, 'CategoryName'
         20        ASSIGN_DIM                                               $14
         21        OP_DATA                                                  ~16
   20    22    > > RETURN                                                   !0
   21    23*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.74 ms | 1012 KiB | 15 Q