3v4l.org

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

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

End of function get_children

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.53 ms | 1402 KiB | 14 Q