3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getCat($val) { $cat = ''; if ($val >= 81) { $cat = 'A'; } else if ($val >= 71 && $val <= 80) { $cat = 'AB'; } else if ($val >= 51 && $val <= 70) { $cat = 'B'; } else { $cat = $val < 40 ? 'C' : 'BC'; } return $cat; } echo getCat(90) . PHP_EOL; echo getCat(72) . PHP_EOL; echo getCat(55) . PHP_EOL; echo getCat(45) . PHP_EOL; echo getCat(10) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EuFvD
function name:  (null)
number of ops:  26
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'getcat'
          1        SEND_VAL                                                 90
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%0A'
          4        ECHO                                                     ~1
   21     5        INIT_FCALL                                               'getcat'
          6        SEND_VAL                                                 72
          7        DO_FCALL                                      0  $2      
          8        CONCAT                                           ~3      $2, '%0A'
          9        ECHO                                                     ~3
   22    10        INIT_FCALL                                               'getcat'
         11        SEND_VAL                                                 55
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '%0A'
         14        ECHO                                                     ~5
   23    15        INIT_FCALL                                               'getcat'
         16        SEND_VAL                                                 45
         17        DO_FCALL                                      0  $6      
         18        CONCAT                                           ~7      $6, '%0A'
         19        ECHO                                                     ~7
   24    20        INIT_FCALL                                               'getcat'
         21        SEND_VAL                                                 10
         22        DO_FCALL                                      0  $8      
         23        CONCAT                                           ~9      $8, '%0A'
         24        ECHO                                                     ~9
   25    25      > RETURN                                                   1

Function getcat:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 10
filename:       /in/EuFvD
function name:  getCat
number of ops:  28
compiled vars:  !0 = $val, !1 = $cat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, ''
    7     2        IS_SMALLER_OR_EQUAL                                      81, !0
          3      > JMPZ                                                     ~3, ->6
    8     4    >   ASSIGN                                                   !1, 'A'
    7     5      > JMP                                                      ->26
    9     6    >   IS_SMALLER_OR_EQUAL                              ~5      71, !0
          7      > JMPZ_EX                                          ~5      ~5, ->10
          8    >   IS_SMALLER_OR_EQUAL                              ~6      !0, 80
          9        BOOL                                             ~5      ~6
         10    > > JMPZ                                                     ~5, ->13
   10    11    >   ASSIGN                                                   !1, 'AB'
    9    12      > JMP                                                      ->26
   11    13    >   IS_SMALLER_OR_EQUAL                              ~8      51, !0
         14      > JMPZ_EX                                          ~8      ~8, ->17
         15    >   IS_SMALLER_OR_EQUAL                              ~9      !0, 70
         16        BOOL                                             ~8      ~9
         17    > > JMPZ                                                     ~8, ->20
   12    18    >   ASSIGN                                                   !1, 'B'
   11    19      > JMP                                                      ->26
   14    20    >   IS_SMALLER                                               !0, 40
         21      > JMPZ                                                     ~11, ->24
         22    >   QM_ASSIGN                                        ~12     'C'
         23      > JMP                                                      ->25
         24    >   QM_ASSIGN                                        ~12     'BC'
         25    >   ASSIGN                                                   !1, ~12
   17    26    > > RETURN                                                   !1
   18    27*     > RETURN                                                   null

End of function getcat

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
271.63 ms | 1016 KiB | 18 Q