3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(isset($_POST["submit"])) { // if submitted assign variables values $low = $_POST["lowNum"]; $highLimit = $_POST["highNum"]; $countLines = 0; $sum_ev = 0; $sum_od = 0; $sum_prm = 0; $constant_prm; } // Function for Prime Numbers Queries function primePrint() { echo "#==================Prime Numbers=========================#"; global $low, $highLimit, $lowLimit, $countLines, $sum_prm; for( $lowLimit = $low; $lowLimit <= $highLimit; $lowLimit++ ) { for( $constant_prm = 2; $constant_prm <= $lowLimit - 1; $constant_prm++ ) { if( $lowLimit % $constant_prm == 0 ) { break; } } if( $constant_prm == $lowLimit ) { $countLines++; echo "<br>"."Prime Number ".$countLines." : ".$lowLimit; $sum_prm = $sum_prm + $lowLimit; } } echo "<br>"; echo "<strong>Total Prime Numbers Count is : </strong>".$countLines; echo "<br>"; echo "<strong>Total Prime Numbers Summation is : </strong>".$sum_prm; echo "<br>"; echo "#=====================================================#"; } // Function for Even Numbers Queries function evenPrint() { echo "#==================Even Numbers=========================#"; global $low, $highLimit, $lowLimit, $countLines, $sum_ev; for( $lowLimit = $low; $lowLimit <= $highLimit; $lowLimit++ ) { if( $lowLimit % 2 == 0 ) { $countLines++; echo "<br>"."Even Number ".$countLines." : ".$lowLimit; $sum_ev = $sum_ev + $lowLimit; } } echo "<br>"; echo "<strong>Total Even Numbers Count is : </strong>".$countLines; echo "<br>"; echo "<strong>Total Even Numbers Summation is : </strong>".$sum_ev; echo "<br>"; echo "#=====================================================#"; } // Function for Odd Numbers Queries function oddPrint() { echo "#==================Odd Numbers=========================#"; global $low, $highLimit, $lowLimit, $countLines, $sum_od; for( $lowLimit = $low, $countLines = 0; $lowLimit <= $highLimit; $lowLimit++ ) { if( $lowLimit % 2 > 0 ) { $countLines++; echo "<br>"."Odd Number ".$countLines." : ".$lowLimit; $sum_od = $sum_od + $lowLimit; } } echo "<br>"; echo "<strong>Total Odd Numbers Count is : </strong>".$countLines; echo "<br>"; echo "<strong>Total Odd Numbers Summation is : </strong>".$sum_od; echo "<br>"; echo "#=====================================================#"; } ?> <?php // Form to get inputs echo "<form action='assignment-2.php' method='post'>"; echo "Enter the range of numbers to find prime, even and odd numbers >>"; echo "<br>"; echo "<br>"; echo "Enter the lower range number : "."<input type='text' name='lowNum'>"; echo "<br>"; echo "Enter the higher range number : "."<input type='text' name='highNum'>"; echo "<br>"; echo "<input type='submit' name='submit' value='Submit'>"; echo "</form>"; ?> <?php echo "<br>"; if(isset($_POST["submit"])) { // if submitted then call the functions primePrint(); echo "<br>"; evenPrint(); echo "<br>"; oddPrint(); } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 37
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 13
filename:       /in/MqJtb
function name:  (null)
number of ops:  38
compiled vars:  !0 = $low, !1 = $highLimit, !2 = $countLines, !3 = $sum_ev, !4 = $sum_od, !5 = $sum_prm, !6 = $constant_prm
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   FETCH_IS                                         ~7      '_POST'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~7, 'submit'
          2      > JMPZ                                                     ~8, ->13
    5     3    >   FETCH_R                      global              ~9      '_POST'
          4        FETCH_DIM_R                                      ~10     ~9, 'lowNum'
          5        ASSIGN                                                   !0, ~10
    6     6        FETCH_R                      global              ~12     '_POST'
          7        FETCH_DIM_R                                      ~13     ~12, 'highNum'
          8        ASSIGN                                                   !1, ~13
    7     9        ASSIGN                                                   !2, 0
    8    10        ASSIGN                                                   !3, 0
    9    11        ASSIGN                                                   !4, 0
   10    12        ASSIGN                                                   !5, 0
   88    13    >   ECHO                                                     '%0A'
   91    14        ECHO                                                     '%3Cform+action%3D%27assignment-2.php%27+method%3D%27post%27%3E'
   92    15        ECHO                                                     'Enter+the+range+of+numbers+to+find+prime%2C+even+and+odd+numbers+%3E%3E'
   93    16        ECHO                                                     '%3Cbr%3E'
   94    17        ECHO                                                     '%3Cbr%3E'
   95    18        ECHO                                                     'Enter+the+lower+range+number+%3A+%3Cinput+type%3D%27text%27+name%3D%27lowNum%27%3E'
   96    19        ECHO                                                     '%3Cbr%3E'
   97    20        ECHO                                                     'Enter+the+higher+range+number+%3A+%3Cinput+type%3D%27text%27+name%3D%27highNum%27%3E'
   98    21        ECHO                                                     '%3Cbr%3E'
   99    22        ECHO                                                     '%3Cinput+type%3D%27submit%27+name%3D%27submit%27+value%3D%27Submit%27%3E'
  100    23        ECHO                                                     '%3C%2Fform%3E'
  102    24        ECHO                                                     '%0A'
  104    25        ECHO                                                     '%3Cbr%3E'
  105    26        FETCH_IS                                         ~19     '_POST'
         27        ISSET_ISEMPTY_DIM_OBJ                         0          ~19, 'submit'
         28      > JMPZ                                                     ~20, ->37
  108    29    >   INIT_FCALL                                               'primeprint'
         30        DO_FCALL                                      0          
  109    31        ECHO                                                     '%3Cbr%3E'
  110    32        INIT_FCALL                                               'evenprint'
         33        DO_FCALL                                      0          
  111    34        ECHO                                                     '%3Cbr%3E'
  112    35        INIT_FCALL                                               'oddprint'
         36        DO_FCALL                                      0          
  114    37    > > RETURN                                                   1

Function primeprint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 8
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 10
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 8
Branch analysis from position: 30
Branch analysis from position: 8
Branch analysis from position: 27
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 10
Branch analysis from position: 18
Branch analysis from position: 10
filename:       /in/MqJtb
function name:  primePrint
number of ops:  39
compiled vars:  !0 = $low, !1 = $highLimit, !2 = $lowLimit, !3 = $countLines, !4 = $sum_prm, !5 = $constant_prm
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ECHO                                                     '%23%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3DPrime+Numbers%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%23'
   18     1        BIND_GLOBAL                                              !0, 'low'
          2        BIND_GLOBAL                                              !1, 'highLimit'
          3        BIND_GLOBAL                                              !2, 'lowLimit'
          4        BIND_GLOBAL                                              !3, 'countLines'
          5        BIND_GLOBAL                                              !4, 'sum_prm'
   19     6        ASSIGN                                                   !2, !0
          7      > JMP                                                      ->28
   21     8    >   ASSIGN                                                   !5, 2
          9      > JMP                                                      ->15
   23    10    >   MOD                                              ~8      !2, !5
         11        IS_EQUAL                                                 ~8, 0
         12      > JMPZ                                                     ~9, ->14
   25    13    > > JMP                                                      ->18
   21    14    >   PRE_INC                                                  !5
         15    >   SUB                                              ~11     !2, 1
         16        IS_SMALLER_OR_EQUAL                                      !5, ~11
         17      > JMPNZ                                                    ~12, ->10
   28    18    >   IS_EQUAL                                                 !5, !2
         19      > JMPZ                                                     ~13, ->27
   30    20    >   PRE_INC                                                  !3
   31    21        CONCAT                                           ~15     '%3Cbr%3EPrime+Number+', !3
         22        CONCAT                                           ~16     ~15, '+%3A+'
         23        CONCAT                                           ~17     ~16, !2
         24        ECHO                                                     ~17
   32    25        ADD                                              ~18     !4, !2
         26        ASSIGN                                                   !4, ~18
   19    27    >   PRE_INC                                                  !2
         28    >   IS_SMALLER_OR_EQUAL                                      !2, !1
         29      > JMPNZ                                                    ~21, ->8
   35    30    >   ECHO                                                     '%3Cbr%3E'
   36    31        CONCAT                                           ~22     '%3Cstrong%3ETotal+Prime+Numbers+Count+is+%3A+%3C%2Fstrong%3E', !3
         32        ECHO                                                     ~22
   37    33        ECHO                                                     '%3Cbr%3E'
   38    34        CONCAT                                           ~23     '%3Cstrong%3ETotal+Prime+Numbers+Summation+is+%3A+%3C%2Fstrong%3E', !4
         35        ECHO                                                     ~23
   39    36        ECHO                                                     '%3Cbr%3E'
   40    37        ECHO                                                     '%23%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%23'
   41    38      > RETURN                                                   null

End of function primeprint

Function evenprint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 8
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 8
Branch analysis from position: 21
Branch analysis from position: 8
Branch analysis from position: 18
filename:       /in/MqJtb
function name:  evenPrint
number of ops:  30
compiled vars:  !0 = $low, !1 = $highLimit, !2 = $lowLimit, !3 = $countLines, !4 = $sum_ev
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   ECHO                                                     '%23%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3DEven+Numbers%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%23'
   47     1        BIND_GLOBAL                                              !0, 'low'
          2        BIND_GLOBAL                                              !1, 'highLimit'
          3        BIND_GLOBAL                                              !2, 'lowLimit'
          4        BIND_GLOBAL                                              !3, 'countLines'
          5        BIND_GLOBAL                                              !4, 'sum_ev'
   48     6        ASSIGN                                                   !2, !0
          7      > JMP                                                      ->19
   50     8    >   MOD                                              ~6      !2, 2
          9        IS_EQUAL                                                 ~6, 0
         10      > JMPZ                                                     ~7, ->18
   52    11    >   PRE_INC                                                  !3
   53    12        CONCAT                                           ~9      '%3Cbr%3EEven+Number+', !3
         13        CONCAT                                           ~10     ~9, '+%3A+'
         14        CONCAT                                           ~11     ~10, !2
         15        ECHO                                                     ~11
   54    16        ADD                                              ~12     !4, !2
         17        ASSIGN                                                   !4, ~12
   48    18    >   PRE_INC                                                  !2
         19    >   IS_SMALLER_OR_EQUAL                                      !2, !1
         20      > JMPNZ                                                    ~15, ->8
   57    21    >   ECHO                                                     '%3Cbr%3E'
   58    22        CONCAT                                           ~16     '%3Cstrong%3ETotal+Even+Numbers+Count+is+%3A+%3C%2Fstrong%3E', !3
         23        ECHO                                                     ~16
   59    24        ECHO                                                     '%3Cbr%3E'
   60    25        CONCAT                                           ~17     '%3Cstrong%3ETotal+Even+Numbers+Summation+is+%3A+%3C%2Fstrong%3E', !4
         26        ECHO                                                     ~17
   61    27        ECHO                                                     '%3Cbr%3E'
   62    28        ECHO                                                     '%23%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%23'
   63    29      > RETURN                                                   null

End of function evenprint

Function oddprint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 9
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 9
Branch analysis from position: 22
Branch analysis from position: 9
Branch analysis from position: 19
filename:       /in/MqJtb
function name:  oddPrint
number of ops:  31
compiled vars:  !0 = $low, !1 = $highLimit, !2 = $lowLimit, !3 = $countLines, !4 = $sum_od
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   68     0  E >   ECHO                                                     '%23%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3DOdd+Numbers%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%23'
   69     1        BIND_GLOBAL                                              !0, 'low'
          2        BIND_GLOBAL                                              !1, 'highLimit'
          3        BIND_GLOBAL                                              !2, 'lowLimit'
          4        BIND_GLOBAL                                              !3, 'countLines'
          5        BIND_GLOBAL                                              !4, 'sum_od'
   70     6        ASSIGN                                                   !2, !0
          7        ASSIGN                                                   !3, 0
          8      > JMP                                                      ->20
   72     9    >   MOD                                              ~7      !2, 2
         10        IS_SMALLER                                               0, ~7
         11      > JMPZ                                                     ~8, ->19
   74    12    >   PRE_INC                                                  !3
   75    13        CONCAT                                           ~10     '%3Cbr%3EOdd+Number+', !3
         14        CONCAT                                           ~11     ~10, '+%3A+'
         15        CONCAT                                           ~12     ~11, !2
         16        ECHO                                                     ~12
   76    17        ADD                                              ~13     !4, !2
         18        ASSIGN                                                   !4, ~13
   70    19    >   PRE_INC                                                  !2
         20    >   IS_SMALLER_OR_EQUAL                                      !2, !1
         21      > JMPNZ                                                    ~16, ->9
   79    22    >   ECHO                                                     '%3Cbr%3E'
   80    23        CONCAT                                           ~17     '%3Cstrong%3ETotal+Odd+Numbers+Count+is+%3A+%3C%2Fstrong%3E', !3
         24        ECHO                                                     ~17
   81    25        ECHO                                                     '%3Cbr%3E'
   82    26        CONCAT                                           ~18     '%3Cstrong%3ETotal+Odd+Numbers+Summation+is+%3A+%3C%2Fstrong%3E', !4
         27        ECHO                                                     ~18
   83    28        ECHO                                                     '%3Cbr%3E'
   84    29        ECHO                                                     '%23%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%23'
   85    30      > RETURN                                                   null

End of function oddprint

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.11 ms | 1406 KiB | 16 Q