3v4l.org

run code in 300+ PHP versions simultaneously
<?php $simpsons = array(); $simpsons[0] = array("name"=>"Abe","parent"=>-1); $simpsons[1] = array("name"=>"Homer","parent"=>0); // Homer's parent is Abe $simpsons[2] = array("name"=>"Bart","parent"=>1); // Bart's parent is Homer $simpsons[3] = array("name"=>"Lisa","parent"=>1); // Lisa's parent is Homer $simpsons[4] = array("name"=>"Maggie","parent"=>1); // Maggie's parent is Homer function get_children($simpsons, $parent) { foreach ($simpsons as $index=>$onesimpson) { if ($onesimpson["parent"]==$parent) { echo "$onesimpson[name] is a child of ".$simpsons[$parent]["name"].".<br />\n"; get_children($simpsons, $index); } } } get_children($simpsons, 0); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZjrF9
function name:  (null)
number of ops:  16
compiled vars:  !0 = $simpsons
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN_DIM                                               !0, 0
          2        OP_DATA                                                  <array>
    4     3        ASSIGN_DIM                                               !0, 1
          4        OP_DATA                                                  <array>
    5     5        ASSIGN_DIM                                               !0, 2
          6        OP_DATA                                                  <array>
    6     7        ASSIGN_DIM                                               !0, 3
          8        OP_DATA                                                  <array>
    7     9        ASSIGN_DIM                                               !0, 4
         10        OP_DATA                                                  <array>
   19    11        INIT_FCALL                                               'get_children'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 0
         14        DO_FCALL                                      0          
   20    15      > RETURN                                                   1

Function get_children:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/ZjrF9
function name:  get_children
number of ops:  23
compiled vars:  !0 = $simpsons, !1 = $parent, !2 = $onesimpson, !3 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2      > FE_RESET_R                                       $4      !0, ->21
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->21
          4    >   ASSIGN                                                   !3, ~5
   12     5        FETCH_DIM_R                                      ~7      !2, 'parent'
          6        IS_EQUAL                                                 !1, ~7
          7      > JMPZ                                                     ~8, ->20
   13     8    >   FETCH_DIM_R                                      ~9      !2, 'name'
          9        NOP                                                      
         10        FAST_CONCAT                                      ~10     ~9, '+is+a+child+of+'
         11        FETCH_DIM_R                                      ~11     !0, !1
         12        FETCH_DIM_R                                      ~12     ~11, 'name'
         13        CONCAT                                           ~13     ~10, ~12
         14        CONCAT                                           ~14     ~13, '.%3Cbr+%2F%3E%0A'
         15        ECHO                                                     ~14
   14    16        INIT_FCALL_BY_NAME                                       'get_children'
         17        SEND_VAR_EX                                              !0
         18        SEND_VAR_EX                                              !3
         19        DO_FCALL                                      0          
   11    20    > > JMP                                                      ->3
         21    >   FE_FREE                                                  $4
   17    22      > RETURN                                                   null

End of function get_children

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.18 ms | 948 KiB | 15 Q