3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getColor($number) { $color = array("black", "lightblue", "gray", "green", "pink", "blueviolet", "red", "blue", "lightgreen", "brown"); if ($number == 100) { return $color[9]; } else if ($number == 0) { return $color[0]; } else if ($number % 10 == 0) { print(3); $value = $number / 10; return $color[floor($value--)]; } else { $value = $number / 10; return $color[floor($value)]; } } print(getColor(30));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1k1WA
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'getcolor'
          1        SEND_VAL                                                 30
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function getcolor:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 25
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1k1WA
function name:  getColor
number of ops:  33
compiled vars:  !0 = $number, !1 = $color, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        IS_EQUAL                                                 !0, 100
          3      > JMPZ                                                     ~4, ->7
    6     4    >   FETCH_DIM_R                                      ~5      !1, 9
          5      > RETURN                                                   ~5
          6*       JMP                                                      ->32
    7     7    >   IS_EQUAL                                                 !0, 0
          8      > JMPZ                                                     ~6, ->12
    8     9    >   FETCH_DIM_R                                      ~7      !1, 0
         10      > RETURN                                                   ~7
         11*       JMP                                                      ->32
    9    12    >   MOD                                              ~8      !0, 10
         13        IS_EQUAL                                                 ~8, 0
         14      > JMPZ                                                     ~9, ->25
   10    15    >   ECHO                                                     3
   11    16        DIV                                              ~10     !0, 10
         17        ASSIGN                                                   !2, ~10
   12    18        INIT_FCALL                                               'floor'
         19        POST_DEC                                         ~12     !2
         20        SEND_VAL                                                 ~12
         21        DO_ICALL                                         $13     
         22        FETCH_DIM_R                                      ~14     !1, $13
         23      > RETURN                                                   ~14
         24*       JMP                                                      ->32
   14    25    >   DIV                                              ~15     !0, 10
         26        ASSIGN                                                   !2, ~15
   15    27        INIT_FCALL                                               'floor'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $17     
         30        FETCH_DIM_R                                      ~18     !1, $17
         31      > RETURN                                                   ~18
   17    32*     > RETURN                                                   null

End of function getcolor

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.99 ms | 1403 KiB | 16 Q