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/SUJdX
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     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 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 30
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 30
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 26
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 7
filename:       /in/SUJdX
function name:  calculValeurEcoGes
number of ops:  33
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
    4     2        ASSIGN                                                   !2, <array>
    8     3        IS_SMALLER                                       ~9      !1, 1
          4      > JMPNZ_EX                                         ~9      ~9, ->7
          5    >   IS_SMALLER                                       ~10     2, !1
          6        BOOL                                             ~9      ~10
          7    > > JMPZ                                                     ~9, ->9
    9     8    > > EXIT                                                     'Erreur%2C+le+type+de+valeur+%C3%A9co.+doit+%C3%AAtre+compris+entre+1+et+2'
   11     9    >   INIT_DYNAMIC_CALL                                        !2
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0  $11     
         12        ASSIGN                                                   !3, $11
   12    13      > FE_RESET_R                                       $13     !3, ->30
         14    > > FE_FETCH_R                                       ~14     $13, !4, ->30
         15    >   ASSIGN                                                   !5, ~14
   13    16        QM_ASSIGN                                        ~16     !4
         17        FETCH_LIST_R                                     $17     ~16, 0
         18        ASSIGN                                                   !6, $17
         19        FETCH_LIST_R                                     $19     ~16, 1
         20        ASSIGN                                                   !7, $19
         21        FREE                                                     ~16
   14    22        IS_SMALLER_OR_EQUAL                              ~21     !6, !0
         23      > JMPZ_EX                                          ~21     ~21, ->26
         24    >   IS_SMALLER_OR_EQUAL                              ~22     !0, !7
         25        BOOL                                             ~21     ~22
         26    > > JMPZ                                                     ~21, ->29
   15    27    >   FE_FREE                                                  $13
         28      > RETURN                                                   !5
   12    29    > > JMP                                                      ->14
         30    >   FE_FREE                                                  $13
   18    31      > RETURN                                                   'Z'
   19    32*     > RETURN                                                   null

End of function calculvaleurecoges

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.33 ms | 1403 KiB | 14 Q