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"; get_children($index); } } } get_children(0); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YR09U
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>
   20    10        INIT_FCALL                                               'get_children'
         11        SEND_VAL                                                 0
         12        DO_FCALL                                      0          
   21    13      > RETURN                                                   1

Function get_children:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/YR09U
function name:  get_children
number of ops:  21
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, ->19
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->19
          4    >   ASSIGN                                                   !3, ~5
   13     5        FETCH_DIM_R                                      ~7      !2, 'parent'
          6        IS_EQUAL                                                 !0, ~7
          7      > JMPZ                                                     ~8, ->18
   14     8    >   FETCH_DIM_R                                      ~9      !2, 'name'
          9        CONCAT                                           ~10     ~9, '+is+a+child+of+'
         10        FETCH_DIM_R                                      ~11     !1, !0
         11        FETCH_DIM_R                                      ~12     ~11, 'name'
         12        CONCAT                                           ~13     ~10, ~12
         13        CONCAT                                           ~14     ~13, '.%3Cbr+%2F%3E%0A'
         14        ECHO                                                     ~14
   15    15        INIT_FCALL_BY_NAME                                       'get_children'
         16        SEND_VAR_EX                                              !3
         17        DO_FCALL                                      0          
   12    18    > > JMP                                                      ->3
         19    >   FE_FREE                                                  $4
   18    20      > RETURN                                                   null

End of function get_children

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.52 ms | 1402 KiB | 14 Q