3v4l.org

run code in 300+ PHP versions simultaneously
<?php const OFFSET = 0.5; function calculate_stars($rating){ return ( ($rating/OFFSET) - 1 ); } function display_star($rating){ $output=""; $str = ""; $step = calculate_stars($rating); for ($i=0, $max = 10; $i < $max; $i++) { echo str_pad($output,$i,"*"),"\n"; } } display_star(0.5);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E13gL
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CONST                                            'OFFSET', 0.5
   17     1        INIT_FCALL                                               'display_star'
          2        SEND_VAL                                                 0.5
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function calculate_stars:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E13gL
function name:  calculate_stars
number of ops:  6
compiled vars:  !0 = $rating
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        FETCH_CONSTANT                                   ~1      'OFFSET'
          2        DIV                                              ~2      !0, ~1
          3        SUB                                              ~3      ~2, 1
          4      > RETURN                                                   ~3
    5     5*     > RETURN                                                   null

End of function calculate_stars

Function display_star:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 10
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 10
Branch analysis from position: 20
Branch analysis from position: 10
filename:       /in/E13gL
function name:  display_star
number of ops:  21
compiled vars:  !0 = $rating, !1 = $output, !2 = $str, !3 = $step, !4 = $i, !5 = $max
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, ''
    8     2        ASSIGN                                                   !2, ''
    9     3        INIT_FCALL                                               'calculate_stars'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $8      
          6        ASSIGN                                                   !3, $8
   11     7        ASSIGN                                                   !4, 0
          8        ASSIGN                                                   !5, 10
          9      > JMP                                                      ->18
   13    10    >   INIT_FCALL                                               'str_pad'
         11        SEND_VAR                                                 !1
         12        SEND_VAR                                                 !4
         13        SEND_VAL                                                 '%2A'
         14        DO_ICALL                                         $12     
         15        ECHO                                                     $12
         16        ECHO                                                     '%0A'
   11    17        PRE_INC                                                  !4
         18    >   IS_SMALLER                                               !4, !5
         19      > JMPNZ                                                    ~14, ->10
   15    20    > > RETURN                                                   null

End of function display_star

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.99 ms | 1007 KiB | 16 Q