3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A1 { public function rows() { $a = array(); $a[] = array('parent_id' => 0, 'category_id' => 7); $a[] = array('parent_id' => 0, 'category_id' => 8); $a[] = array('parent_id' => 0, 'category_id' => 9); $a[] = array('parent_id' => 7, 'category_id' => 10); $a[] = array('parent_id' => 7, 'category_id' => 11); $a[] = array('parent_id' => 8, 'category_id' => 12); $a[] = array('parent_id' => 10, 'category_id' => 13); return $a; } } /* foreach($query->rows() as $row) { if(isset($categoryArray[$row['category_id']])) { $categoryArray[$row['parent_id']] = $row['category_id']; } else { $categoryArray[$row['parent_id']][$row['category_id']] = $row['name']; } } */ $query = new A1; $a = $query->rows(); print_r($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BgGrL
function name:  (null)
number of ops:  10
compiled vars:  !0 = $query, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $2      'A1'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   31     3        INIT_METHOD_CALL                                         !0, 'rows'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   33     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class A1:
Function rows:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BgGrL
function name:  rows
number of ops:  17
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  <array>
    7     3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  <array>
    8     5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  <array>
    9     7        ASSIGN_DIM                                               !0
          8        OP_DATA                                                  <array>
   10     9        ASSIGN_DIM                                               !0
         10        OP_DATA                                                  <array>
   11    11        ASSIGN_DIM                                               !0
         12        OP_DATA                                                  <array>
   12    13        ASSIGN_DIM                                               !0
         14        OP_DATA                                                  <array>
   14    15      > RETURN                                                   !0
   15    16*     > RETURN                                                   null

End of function rows

End of class A1.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.45 ms | 1387 KiB | 15 Q