3v4l.org

run code in 500+ PHP versions simultaneously
<?php function stars($starNumber) { for( $x = 0; $x < 5; $x++ ) { if( floor($starNumber)-$x >= 1 ) { echo '<i class="fa fa-star"></i>'; } elseif( $starNumber-$x > 0 ) { echo '<i class="fa fa-star-half-o"></i>'; } else { echo '<i class="fa fa-star-o"></i>'; } } } $stars = array(2, 2.5, 4.5, 5); foreach($stars as $starNumber) { echo "{$starNumber} stars:\n"; stars($starNumber); echo "\n\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 11
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/sYdtC
function name:  (null)
number of ops:  13
compiled vars:  !0 = $stars, !1 = $starNumber
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                       !0, <array>
   15     1      > FE_RESET_R                                           $3      !0, ->11
          2    > > FE_FETCH_R                                                   $3, !1, ->11
   16     3    >   NOP                                                          
          4        FAST_CONCAT                                          ~4      !1, '+stars%3A%0A'
          5        ECHO                                                         ~4
   17     6        INIT_FCALL                                                   'stars'
          7        SEND_VAR                                                     !1
          8        DO_FCALL                                          0          
   18     9        ECHO                                                         '%0A%0A'
   15    10      > JMP                                                          ->2
         11    >   FE_FREE                                                      $3
   19    12      > RETURN                                                       1

Function stars:
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 = 3
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 3
Branch analysis from position: 20
Branch analysis from position: 3
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 3
Branch analysis from position: 20
Branch analysis from position: 3
filename:       /in/sYdtC
function name:  stars
number of ops:  21
compiled vars:  !0 = $starNumber, !1 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   RECV                                                 !0      
    3     1        ASSIGN                                                       !1, 0
          2      > JMP                                                          ->18
    5     3    >   INIT_FCALL                                                   'floor'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $3      
          6        SUB                                                  ~4      $3, !1
          7        IS_SMALLER_OR_EQUAL                                          1, ~4
          8      > JMPZ                                                         ~5, ->11
    6     9    >   ECHO                                                         '%3Ci+class%3D%22fa+fa-star%22%3E%3C%2Fi%3E'
    5    10      > JMP                                                          ->17
    7    11    >   SUB                                                  ~6      !0, !1
         12        IS_SMALLER                                                   0, ~6
         13      > JMPZ                                                         ~7, ->16
    8    14    >   ECHO                                                         '%3Ci+class%3D%22fa+fa-star-half-o%22%3E%3C%2Fi%3E'
    7    15      > JMP                                                          ->17
   10    16    >   ECHO                                                         '%3Ci+class%3D%22fa+fa-star-o%22%3E%3C%2Fi%3E'
    3    17    >   PRE_INC                                                      !1
         18    >   IS_SMALLER                                                   !1, 5
         19      > JMPNZ                                                        ~9, ->3
   12    20    > > RETURN                                                       null

End of function stars

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
180.95 ms | 1859 KiB | 15 Q