3v4l.org

run code in 300+ PHP versions simultaneously
<?php function resize($count) { $n = $count % 10; //round the count to the nearest 10... $size = ($n > 5) ? $count - $n : $count + $n; //normalise the size to be between 10 and 100 if ($size < 10) { $size = 10; } elseif ($size > 100) { $size = 100; } //normalise the size to be between 1 and 10 $size = $size/10; return $size; } var_dump(resize(63)); var_dump(resize(65)); var_dump(resize(13)); var_dump(resize(15)); var_dump(resize(21));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wd2p1
function name:  (null)
number of ops:  31
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'resize'
          2        SEND_VAL                                                 63
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   23     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'resize'
          8        SEND_VAL                                                 65
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   25    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'resize'
         14        SEND_VAL                                                 13
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
   27    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'resize'
         20        SEND_VAL                                                 15
         21        DO_FCALL                                      0  $6      
         22        SEND_VAR                                                 $6
         23        DO_ICALL                                                 
   29    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'resize'
         26        SEND_VAL                                                 21
         27        DO_FCALL                                      0  $8      
         28        SEND_VAR                                                 $8
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function resize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
Branch analysis from position: 15
filename:       /in/Wd2p1
function name:  resize
number of ops:  22
compiled vars:  !0 = $count, !1 = $n, !2 = $size
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        MOD                                              ~3      !0, 10
          2        ASSIGN                                                   !1, ~3
    6     3        IS_SMALLER                                               5, !1
          4      > JMPZ                                                     ~5, ->8
          5    >   SUB                                              ~6      !0, !1
          6        QM_ASSIGN                                        ~7      ~6
          7      > JMP                                                      ->10
          8    >   ADD                                              ~8      !0, !1
          9        QM_ASSIGN                                        ~7      ~8
         10    >   ASSIGN                                                   !2, ~7
    9    11        IS_SMALLER                                               !2, 10
         12      > JMPZ                                                     ~10, ->15
   10    13    >   ASSIGN                                                   !2, 10
         14      > JMP                                                      ->18
   11    15    >   IS_SMALLER                                               100, !2
         16      > JMPZ                                                     ~12, ->18
   12    17    >   ASSIGN                                                   !2, 100
   16    18    >   DIV                                              ~14     !2, 10
         19        ASSIGN                                                   !2, ~14
   18    20      > RETURN                                                   !2
   19    21*     > RETURN                                                   null

End of function resize

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.08 ms | 1403 KiB | 20 Q