3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_planet_house(array $houses,$in_long) { for($i=1;$i<=12;$i++) { $left=$houses[$i]["longitude"]; $right=($i==12?$houses[1]["longitude"]:$houses[$i+1]["longitude"]); if(($left<=$right && $in_long>=$left && $in_long<$right) || ($left>$right && ($in_long>=$left || $in_long<$right))) { return $i; } } return 0; } $houses=[]; $houses[1]['longitude']=144; $houses[2]['longitude']=164; $houses[3]['longitude']=190; $houses[4]['longitude']=223; $houses[5]['longitude']=261; $houses[6]['longitude']=296; $houses[7]['longitude']=324; $houses[8]['longitude']=344; $houses[9]['longitude']=10; $houses[10]['longitude']=43; $houses[11]['longitude']=81; $houses[12]['longitude']=116; $planets=[]; $planets['Sun']['longitude']=9; $planets['Moon']['longitude']=341; $planets['Mercury']['longitude']=27; $planets['Venus']['longitude']=349; foreach($planets as $planet=>$info) { echo "{$planet}\t"; echo get_planet_house($houses,$info["longitude"]); echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 51, Position 2 = 64
Branch analysis from position: 51
2 jumps found. (Code = 78) Position 1 = 52, Position 2 = 64
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
filename:       /in/hegMe
function name:  (null)
number of ops:  66
compiled vars:  !0 = $houses, !1 = $planets, !2 = $info, !3 = $planet
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   16     1        FETCH_DIM_W                                      $5      !0, 1
          2        ASSIGN_DIM                                               $5, 'longitude'
          3        OP_DATA                                                  144
   17     4        FETCH_DIM_W                                      $7      !0, 2
          5        ASSIGN_DIM                                               $7, 'longitude'
          6        OP_DATA                                                  164
   18     7        FETCH_DIM_W                                      $9      !0, 3
          8        ASSIGN_DIM                                               $9, 'longitude'
          9        OP_DATA                                                  190
   19    10        FETCH_DIM_W                                      $11     !0, 4
         11        ASSIGN_DIM                                               $11, 'longitude'
         12        OP_DATA                                                  223
   20    13        FETCH_DIM_W                                      $13     !0, 5
         14        ASSIGN_DIM                                               $13, 'longitude'
         15        OP_DATA                                                  261
   21    16        FETCH_DIM_W                                      $15     !0, 6
         17        ASSIGN_DIM                                               $15, 'longitude'
         18        OP_DATA                                                  296
   22    19        FETCH_DIM_W                                      $17     !0, 7
         20        ASSIGN_DIM                                               $17, 'longitude'
         21        OP_DATA                                                  324
   23    22        FETCH_DIM_W                                      $19     !0, 8
         23        ASSIGN_DIM                                               $19, 'longitude'
         24        OP_DATA                                                  344
   24    25        FETCH_DIM_W                                      $21     !0, 9
         26        ASSIGN_DIM                                               $21, 'longitude'
         27        OP_DATA                                                  10
   25    28        FETCH_DIM_W                                      $23     !0, 10
         29        ASSIGN_DIM                                               $23, 'longitude'
         30        OP_DATA                                                  43
   26    31        FETCH_DIM_W                                      $25     !0, 11
         32        ASSIGN_DIM                                               $25, 'longitude'
         33        OP_DATA                                                  81
   27    34        FETCH_DIM_W                                      $27     !0, 12
         35        ASSIGN_DIM                                               $27, 'longitude'
         36        OP_DATA                                                  116
   28    37        ASSIGN                                                   !1, <array>
   29    38        FETCH_DIM_W                                      $30     !1, 'Sun'
         39        ASSIGN_DIM                                               $30, 'longitude'
         40        OP_DATA                                                  9
   30    41        FETCH_DIM_W                                      $32     !1, 'Moon'
         42        ASSIGN_DIM                                               $32, 'longitude'
         43        OP_DATA                                                  341
   31    44        FETCH_DIM_W                                      $34     !1, 'Mercury'
         45        ASSIGN_DIM                                               $34, 'longitude'
         46        OP_DATA                                                  27
   32    47        FETCH_DIM_W                                      $36     !1, 'Venus'
         48        ASSIGN_DIM                                               $36, 'longitude'
         49        OP_DATA                                                  349
   33    50      > FE_RESET_R                                       $38     !1, ->64
         51    > > FE_FETCH_R                                       ~39     $38, !2, ->64
         52    >   ASSIGN                                                   !3, ~39
   35    53        NOP                                                      
         54        FAST_CONCAT                                      ~41     !3, '%09'
         55        ECHO                                                     ~41
   36    56        INIT_FCALL                                               'get_planet_house'
         57        SEND_VAR                                                 !0
         58        FETCH_DIM_R                                      ~42     !2, 'longitude'
         59        SEND_VAL                                                 ~42
         60        DO_FCALL                                      0  $43     
         61        ECHO                                                     $43
   37    62        ECHO                                                     '%0A'
   33    63      > JMP                                                      ->51
         64    >   FE_FREE                                                  $38
   38    65      > RETURN                                                   1

Function get_planet_house:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 4
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
2 jumps found. (Code = 47) Position 1 = 26, Position 2 = 34
Branch analysis from position: 26
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 33
Branch analysis from position: 28
2 jumps found. (Code = 47) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 4
Branch analysis from position: 39
Branch analysis from position: 4
Branch analysis from position: 32
Branch analysis from position: 33
Branch analysis from position: 34
Branch analysis from position: 25
Branch analysis from position: 22
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
Branch analysis from position: 22
filename:       /in/hegMe
function name:  get_planet_house
number of ops:  41
compiled vars:  !0 = $houses, !1 = $in_long, !2 = $i, !3 = $left, !4 = $right
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, 1
          3      > JMP                                                      ->37
    6     4    >   FETCH_DIM_R                                      ~6      !0, !2
          5        FETCH_DIM_R                                      ~7      ~6, 'longitude'
          6        ASSIGN                                                   !3, ~7
    7     7        IS_EQUAL                                                 !2, 12
          8      > JMPZ                                                     ~9, ->13
          9    >   FETCH_DIM_R                                      ~10     !0, 1
         10        FETCH_DIM_R                                      ~11     ~10, 'longitude'
         11        QM_ASSIGN                                        ~12     ~11
         12      > JMP                                                      ->17
         13    >   ADD                                              ~13     !2, 1
         14        FETCH_DIM_R                                      ~14     !0, ~13
         15        FETCH_DIM_R                                      ~15     ~14, 'longitude'
         16        QM_ASSIGN                                        ~12     ~15
         17    >   ASSIGN                                                   !4, ~12
    8    18        IS_SMALLER_OR_EQUAL                              ~17     !3, !4
         19      > JMPZ_EX                                          ~17     ~17, ->22
         20    >   IS_SMALLER_OR_EQUAL                              ~18     !3, !1
         21        BOOL                                             ~17     ~18
         22    > > JMPZ_EX                                          ~17     ~17, ->25
         23    >   IS_SMALLER                                       ~19     !1, !4
         24        BOOL                                             ~17     ~19
         25    > > JMPNZ_EX                                         ~17     ~17, ->34
         26    >   IS_SMALLER                                       ~20     !4, !3
         27      > JMPZ_EX                                          ~20     ~20, ->33
         28    >   IS_SMALLER_OR_EQUAL                              ~21     !3, !1
         29      > JMPNZ_EX                                         ~21     ~21, ->32
         30    >   IS_SMALLER                                       ~22     !1, !4
         31        BOOL                                             ~21     ~22
         32    >   BOOL                                             ~20     ~21
         33    >   BOOL                                             ~17     ~20
         34    > > JMPZ                                                     ~17, ->36
   10    35    > > RETURN                                                   !2
    4    36    >   PRE_INC                                                  !2
         37    >   IS_SMALLER_OR_EQUAL                                      !2, 12
         38      > JMPNZ                                                    ~24, ->4
   13    39    > > RETURN                                                   0
   14    40*     > RETURN                                                   null

End of function get_planet_house

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
277.76 ms | 1020 KiB | 14 Q