3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bass = "Cb"; $selected_scale = 11; $major_scales = array ( array("C","D","E","F","G","A","B","C","D","E","F","G","A","B",), array("C#","D#","E#","F#","G#","A#","B#","C#","D#","E#","F#","G#","A#","B#",), array("Db","Eb","F","Gb","Ab","Bb","C","Db","Eb","F","Gb","Ab","Bb","C",), array("D","E","F#","G","A","B","C#","D","E","F#","G","A","B","C#"), array("D#","E#","F##","G#","A#","B#","C##","D#","E#","F##","G#","A#","B#","C##"), array("Eb","F","G","Ab","Bb","C","D","Eb","F","G","Ab","Bb","C","D"), array("E","F#","G#","A","B","C#","D#","E","F#","G#","A","B","C#","D#"), array("E#","F##","G##","A#","B#","C##","D##","E#","F##","G##","A#","B#","C##","D##"), array("Fb","Gb","Ab","Bbb","Cb","Db","Eb","Fb","Gb","Ab","Bbb","Cb","Db","Eb"), array("F","G","A","Bb","C","D","E","F","G","A","Bb","C","D","E"), array("F#","G#","A#","B","C#","D#","E#","F#","G#","A#","B","C#","D#","E#"), array("Gb","Ab","Bb","Cb","Db","Eb","F","Gb","Ab","Bb","Cb","Db","Eb","F"), array("G","A","B","C","D","E","F#","G","A","B","C","D","E","F#"), array("G#","A#","B#","C#","D#","E#","F##","G#","A#","B#","C#","D#","E#","F##"), array("Ab","Bb","C","Db","Eb","F","G","Ab","Bb","C","Db","Eb","F","G"), array("A","B","C#","D","E","F#","G#","A","B","C#","D","E","F#","G#"), array("A#","B#","C##","D#","E#","F##","G##","A#","B#","C##","D#","E#","F##","G##"), array("Bb","C","D","Eb","F","G","A","Bb","C","D","Eb","F","G","A"), array("B","C#","D#","E","F#","G#","A#","B","C#","D#","E","F#","G#","A#"), array("B#","C##","D##","E#","F##","G##","A##","B#","C##","D##","E#","F##","G##","A##"), array("Cb","Db","Eb","Fb","Gb","Ab","Bb","Cb","Db","Eb","Fb","Gb","Ab","Bb") ); // if value exists in mentioned index if (in_array($bass,$major_scales[$selected_scale])){ // index of that value in that array $tmp_ind = array_search($bass,$major_scales[$selected_scale]); // length of the array $len = count($major_scales[$selected_scale]); // store values after this value $res = []; for ($i=$tmp_ind;$i<$len;$i++){ $res[$i] = $major_scales[$selected_scale][$i]; } } print_r($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 28
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 21
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 21
Branch analysis from position: 28
Branch analysis from position: 21
Branch analysis from position: 28
filename:       /in/HTrm2
function name:  (null)
number of ops:  32
compiled vars:  !0 = $bass, !1 = $selected_scale, !2 = $major_scales, !3 = $tmp_ind, !4 = $len, !5 = $res, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Cb'
    3     1        ASSIGN                                                   !1, 11
    4     2        ASSIGN                                                   !2, <array>
   30     3        INIT_FCALL                                               'in_array'
          4        SEND_VAR                                                 !0
          5        FETCH_DIM_R                                      ~10     !2, !1
          6        SEND_VAL                                                 ~10
          7        DO_ICALL                                         $11     
          8      > JMPZ                                                     $11, ->28
   32     9    >   INIT_FCALL                                               'array_search'
         10        SEND_VAR                                                 !0
         11        FETCH_DIM_R                                      ~12     !2, !1
         12        SEND_VAL                                                 ~12
         13        DO_ICALL                                         $13     
         14        ASSIGN                                                   !3, $13
   35    15        FETCH_DIM_R                                      ~15     !2, !1
         16        COUNT                                            ~16     ~15
         17        ASSIGN                                                   !4, ~16
   38    18        ASSIGN                                                   !5, <array>
   39    19        ASSIGN                                                   !6, !3
         20      > JMP                                                      ->26
   40    21    >   FETCH_DIM_R                                      ~21     !2, !1
         22        FETCH_DIM_R                                      ~22     ~21, !6
         23        ASSIGN_DIM                                               !5, !6
         24        OP_DATA                                                  ~22
   39    25        PRE_INC                                                  !6
         26    >   IS_SMALLER                                               !6, !4
         27      > JMPNZ                                                    ~24, ->21
   43    28    >   INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !5
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
230.99 ms | 955 KiB | 16 Q