3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calculValeurEcoGes($valeur, $type = 1) { $intervalles = array( // Indice 1= Eco, Indice 2=GES 1 => array ('A' => array(0, 50), 'B' => array(51, 90), 'C' => array(91, 150), 'D' => array(151, 230), 'E' => array(231, 330), 'F' => array(331, 450), G => array(451, 99999)), 2 => array('A' => array(0, 5), 'B' => array(6, 10), 'C' => array(11, 20), 'D' => array(21, 35), 'E' => array(36, 55), 'F' => array(56, 80), 'G' => array(81, 99999)) ); if($type < 1 || $type > 2) { exit("Erreur, le type de valeur éco. doit être compris entre 1 et 2"); } $intervalle = $intervalles($type); foreach($intervalle as $lettre => $minMax) { list($min, $max) = $minMax; if($valeur >= $min && $valeur <= $max) { return $lettre; } } return 'Z'; } echo calculValeurEcoGes(40, 1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DJh8B
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'calculvaleurecoges'
          1        SEND_VAL                                                 40
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function calculvaleurecoges:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 40
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 40
Branch analysis from position: 25
2 jumps found. (Code = 46) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 36
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 17
filename:       /in/DJh8B
function name:  calculValeurEcoGes
number of ops:  43
compiled vars:  !0 = $valeur, !1 = $type, !2 = $intervalles, !3 = $intervalle, !4 = $minMax, !5 = $lettre, !6 = $min, !7 = $max
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      1
    5     2        INIT_ARRAY                                       ~8      <array>, 'A'
          3        ADD_ARRAY_ELEMENT                                ~8      <array>, 'B'
          4        ADD_ARRAY_ELEMENT                                ~8      <array>, 'C'
          5        ADD_ARRAY_ELEMENT                                ~8      <array>, 'D'
          6        ADD_ARRAY_ELEMENT                                ~8      <array>, 'E'
          7        ADD_ARRAY_ELEMENT                                ~8      <array>, 'F'
          8        FETCH_CONSTANT                                   ~9      'G'
          9        ADD_ARRAY_ELEMENT                                ~8      <array>, ~9
         10        INIT_ARRAY                                       ~10     ~8, 1
         11        ADD_ARRAY_ELEMENT                                ~10     <array>, 2
    4    12        ASSIGN                                                   !2, ~10
    8    13        IS_SMALLER                                       ~12     !1, 1
         14      > JMPNZ_EX                                         ~12     ~12, ->17
         15    >   IS_SMALLER                                       ~13     2, !1
         16        BOOL                                             ~12     ~13
         17    > > JMPZ                                                     ~12, ->19
    9    18    > > EXIT                                                     'Erreur%2C+le+type+de+valeur+%C3%A9co.+doit+%C3%AAtre+compris+entre+1+et+2'
   11    19    >   INIT_DYNAMIC_CALL                                        !2
         20        SEND_VAR_EX                                              !1
         21        DO_FCALL                                      0  $14     
         22        ASSIGN                                                   !3, $14
   12    23      > FE_RESET_R                                       $16     !3, ->40
         24    > > FE_FETCH_R                                       ~17     $16, !4, ->40
         25    >   ASSIGN                                                   !5, ~17
   13    26        QM_ASSIGN                                        ~19     !4
         27        FETCH_LIST_R                                     $20     ~19, 0
         28        ASSIGN                                                   !6, $20
         29        FETCH_LIST_R                                     $22     ~19, 1
         30        ASSIGN                                                   !7, $22
         31        FREE                                                     ~19
   14    32        IS_SMALLER_OR_EQUAL                              ~24     !6, !0
         33      > JMPZ_EX                                          ~24     ~24, ->36
         34    >   IS_SMALLER_OR_EQUAL                              ~25     !0, !7
         35        BOOL                                             ~24     ~25
         36    > > JMPZ                                                     ~24, ->39
   15    37    >   FE_FREE                                                  $16
         38      > RETURN                                                   !5
   12    39    > > JMP                                                      ->24
         40    >   FE_FREE                                                  $16
   18    41      > RETURN                                                   'Z'
   19    42*     > RETURN                                                   null

End of function calculvaleurecoges

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.22 ms | 1407 KiB | 14 Q