3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<JSON [{ "updatedDate": null, "active": true, "id": 80, "lessonName": "HZİ 413 Language in Use", "educationDegree": "Lisans", "academicYear": "2013-2014", "language": "İngilizce", "lessonHour": 4, "addedDate": "2014-02-21T19:54:23+0000" }, { "updatedDate": null, "active": true, "id": 81, "lessonName": "HZİ 411 English in Context I", "educationDegree": "Lisans", "academicYear": "2013-2014", "language": "İngilizce", "lessonHour": 8, "addedDate": "2014-02-21T19:53:47+0000" }, { "updatedDate": null, "active": true, "id": 82, "lessonName": "HZİ 512 English in Context II ", "educationDegree": "Lisans", "academicYear": "2014-2015", "language": "İngilizce", "lessonHour": 12, "addedDate": "2014-02-21T19:52:44+0000" }] JSON; $input = json_decode($json, true); $groups = []; $groupBy = 'academicYear'; foreach ($input as $element) { if (!array_key_exists($element[$groupBy], $groups)) { $groups[$element[$groupBy]] = []; } $groups[$element[$groupBy]][] = $element; } print_r($groups);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 22
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/kqsQl
function name:  (null)
number of ops:  27
compiled vars:  !0 = $json, !1 = $input, !2 = $groups, !3 = $groupBy, !4 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%7B%0A++%22updatedDate%22%3A+null%2C%0A++%22active%22%3A+true%2C%0A++%22id%22%3A+80%2C%0A++%22lessonName%22%3A+%22HZ%C4%B0+413+Language+in+Use%22%2C%0A++%22educationDegree%22%3A+%22Lisans%22%2C%0A++%22academicYear%22%3A+%222013-2014%22%2C%0A++%22language%22%3A+%22%C4%B0ngilizce%22%2C%0A++%22lessonHour%22%3A+4%2C%0A++%22addedDate%22%3A+%222014-02-21T19%3A54%3A23%2B0000%22%0A%7D%2C+%7B%0A++%22updatedDate%22%3A+null%2C%0A++%22active%22%3A+true%2C%0A++%22id%22%3A+81%2C%0A++%22lessonName%22%3A+%22HZ%C4%B0+411+English+in+Context+I%22%2C%0A++%22educationDegree%22%3A+%22Lisans%22%2C%0A++%22academicYear%22%3A+%222013-2014%22%2C%0A++%22language%22%3A+%22%C4%B0ngilizce%22%2C%0A++%22lessonHour%22%3A+8%2C%0A++%22addedDate%22%3A+%222014-02-21T19%3A53%3A47%2B0000%22%0A%7D%2C+%7B%0A++%22updatedDate%22%3A+null%2C%0A++%22active%22%3A+true%2C%0A++%22id%22%3A+82%2C%0A++%22lessonName%22%3A+%22HZ%C4%B0+512+English+in+Context+II+%22%2C%0A++%22educationDegree%22%3A+%22Lisans%22%2C%0A++%22academicYear%22%3A+%222014-2015%22%2C%0A++%22language%22%3A+%22%C4%B0ngilizce%22%2C%0A++%22lessonHour%22%3A+12%2C%0A++%22addedDate%22%3A+%222014-02-21T19%3A52%3A44%2B0000%22%0A%7D%5D'
   37     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
   39     6        ASSIGN                                                   !2, <array>
   40     7        ASSIGN                                                   !3, 'academicYear'
   42     8      > FE_RESET_R                                       $10     !1, ->22
          9    > > FE_FETCH_R                                               $10, !4, ->22
   43    10    >   FETCH_DIM_R                                      ~11     !4, !3
         11        ARRAY_KEY_EXISTS                                 ~12     ~11, !2
         12        BOOL_NOT                                         ~13     ~12
         13      > JMPZ                                                     ~13, ->17
   44    14    >   FETCH_DIM_R                                      ~14     !4, !3
         15        ASSIGN_DIM                                               !2, ~14
         16        OP_DATA                                                  <array>
   47    17    >   FETCH_DIM_R                                      ~16     !4, !3
         18        FETCH_DIM_W                                      $17     !2, ~16
         19        ASSIGN_DIM                                               $17
         20        OP_DATA                                                  !4
   42    21      > JMP                                                      ->9
         22    >   FE_FREE                                                  $10
   50    23        INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.62 ms | 1400 KiB | 17 Q