3v4l.org

run code in 300+ PHP versions simultaneously
<?php // you'll have to add more data to cover all the cases $data = [ 0 => [1 => 2, 2 => 2, 3 => 4, 4 => 4, 5 => 6], 1 => [1 => 2, 2 => 4, 3 => 6, 4 => 6, 5 => 12], ]; $compliance = 0; $risk = 2; // retrieve the value $frequency = $data[$compliance][$risk]; printf( 'compliance %d and risk %d = %d months', $compliance, $risk, $frequency ); print PHP_EOL; $compliance = 1; $risk = 5; $frequency = $data[$compliance][$risk]; printf( 'compliance %d and risk %d = %d months', $compliance, $risk, $frequency );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MPJtI
function name:  (null)
number of ops:  25
compiled vars:  !0 = $data, !1 = $compliance, !2 = $risk, !3 = $frequency
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, 0
   10     2        ASSIGN                                                   !2, 2
   12     3        FETCH_DIM_R                                      ~7      !0, !1
          4        FETCH_DIM_R                                      ~8      ~7, !2
          5        ASSIGN                                                   !3, ~8
   14     6        INIT_FCALL                                               'printf'
   15     7        SEND_VAL                                                 'compliance+%25d+and+risk+%25d+%3D+%25d+months'
   16     8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !2
         10        SEND_VAR                                                 !3
   14    11        DO_ICALL                                                 
   19    12        ECHO                                                     '%0A'
   21    13        ASSIGN                                                   !1, 1
   22    14        ASSIGN                                                   !2, 5
   23    15        FETCH_DIM_R                                      ~13     !0, !1
         16        FETCH_DIM_R                                      ~14     ~13, !2
         17        ASSIGN                                                   !3, ~14
   25    18        INIT_FCALL                                               'printf'
   26    19        SEND_VAL                                                 'compliance+%25d+and+risk+%25d+%3D+%25d+months'
   27    20        SEND_VAR                                                 !1
         21        SEND_VAR                                                 !2
         22        SEND_VAR                                                 !3
   25    23        DO_ICALL                                                 
   28    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
209.44 ms | 1009 KiB | 14 Q