3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Setup the connection to the database $con=mysqli_connect("mysql11.citynetwork.se","125966-hv96625","SidTheKidCrosby8778","125966-show-ratings"); $showID = get_the_ID(); // Fetch all available columns for the current show with the ID $showID $row = mysqli_fetch_array(mysqli_query($con,"SELECT * FROM `125966-show-ratings`.`ratings_for_shows` WHERE SHOW_ID=$showID")); $show_rating_link = ""; $show_rating_one_count = $row['one_vote']; $show_rating_two_count = $row['two_vote']; $show_rating_three_count = $row['three_vote']; $show_rating_four_count = $row['four_vote']; $show_rating_five_count = $row['five_vote']; $show_rating_six_count = $row['six_vote']; $show_rating_seven_count = $row['seven_vote']; $show_rating_eight_count = $row['eight_vote']; $show_rating_nine_count = $row['nine_vote']; $show_rating_ten_count = $row['ten_vote']; // Count the number of votes available in the database for all the fields $number_of_votes = $show_rating_one_count + $show_rating_two_count + $show_rating_three_count + $show_rating_four_count + $show_rating_five_count + $show_rating_six_count + $show_rating_seven_count + $show_rating_eight_count + $show_rating_nine_count + $show_rating_ten_count; // Count the sum of all the votes $sum_of_votes = 1 * $show_rating_one_count + 2 * $show_rating_two_count + 3 * $show_rating_three_count + 4 * $show_rating_four_count + 5 * $show_rating_five_count + 6 * $show_rating_six_count + 7 * $show_rating_seven_count + 8 * $show_rating_eight_count + 9 * $show_rating_nine_count + 10 * $show_rating_ten_count; // Count the max possible value $max_possible_sum = 10 * $number_of_votes; // Calculate the rating in percent with one decimal maximum $rating = round(($sum_of_votes / ($max_possible_sum) * 100) * 10) / 10;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1QHjt
function name:  (null)
number of ops:  82
compiled vars:  !0 = $con, !1 = $showID, !2 = $row, !3 = $show_rating_link, !4 = $show_rating_one_count, !5 = $show_rating_two_count, !6 = $show_rating_three_count, !7 = $show_rating_four_count, !8 = $show_rating_five_count, !9 = $show_rating_six_count, !10 = $show_rating_seven_count, !11 = $show_rating_eight_count, !12 = $show_rating_nine_count, !13 = $show_rating_ten_count, !14 = $number_of_votes, !15 = $sum_of_votes, !16 = $max_possible_sum, !17 = $rating
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'mysqli_connect'
          1        SEND_VAL_EX                                              'mysql11.citynetwork.se'
          2        SEND_VAL_EX                                              '125966-hv96625'
          3        SEND_VAL_EX                                              'SidTheKidCrosby8778'
          4        SEND_VAL_EX                                              '125966-show-ratings'
          5        DO_FCALL                                      0  $18     
          6        ASSIGN                                                   !0, $18
    5     7        INIT_FCALL_BY_NAME                                       'get_the_ID'
          8        DO_FCALL                                      0  $20     
          9        ASSIGN                                                   !1, $20
    8    10        INIT_FCALL_BY_NAME                                       'mysqli_fetch_array'
         11        INIT_FCALL_BY_NAME                                       'mysqli_query'
         12        SEND_VAR_EX                                              !0
         13        NOP                                                      
         14        FAST_CONCAT                                      ~22     'SELECT+%2A+FROM+%60125966-show-ratings%60.%60ratings_for_shows%60+WHERE+SHOW_ID%3D', !1
         15        SEND_VAL_EX                                              ~22
         16        DO_FCALL                                      0  $23     
         17        SEND_VAR_NO_REF_EX                                       $23
         18        DO_FCALL                                      0  $24     
         19        ASSIGN                                                   !2, $24
   10    20        ASSIGN                                                   !3, ''
   12    21        FETCH_DIM_R                                      ~27     !2, 'one_vote'
         22        ASSIGN                                                   !4, ~27
   13    23        FETCH_DIM_R                                      ~29     !2, 'two_vote'
         24        ASSIGN                                                   !5, ~29
   14    25        FETCH_DIM_R                                      ~31     !2, 'three_vote'
         26        ASSIGN                                                   !6, ~31
   15    27        FETCH_DIM_R                                      ~33     !2, 'four_vote'
         28        ASSIGN                                                   !7, ~33
   16    29        FETCH_DIM_R                                      ~35     !2, 'five_vote'
         30        ASSIGN                                                   !8, ~35
   17    31        FETCH_DIM_R                                      ~37     !2, 'six_vote'
         32        ASSIGN                                                   !9, ~37
   18    33        FETCH_DIM_R                                      ~39     !2, 'seven_vote'
         34        ASSIGN                                                   !10, ~39
   19    35        FETCH_DIM_R                                      ~41     !2, 'eight_vote'
         36        ASSIGN                                                   !11, ~41
   20    37        FETCH_DIM_R                                      ~43     !2, 'nine_vote'
         38        ASSIGN                                                   !12, ~43
   21    39        FETCH_DIM_R                                      ~45     !2, 'ten_vote'
         40        ASSIGN                                                   !13, ~45
   24    41        ADD                                              ~47     !4, !5
         42        ADD                                              ~48     ~47, !6
         43        ADD                                              ~49     ~48, !7
         44        ADD                                              ~50     ~49, !8
   25    45        ADD                                              ~51     ~50, !9
         46        ADD                                              ~52     ~51, !10
         47        ADD                                              ~53     ~52, !11
         48        ADD                                              ~54     ~53, !12
         49        ADD                                              ~55     ~54, !13
   24    50        ASSIGN                                                   !14, ~55
   28    51        MUL                                              ~57     !4, 1
         52        MUL                                              ~58     !5, 2
         53        ADD                                              ~59     ~57, ~58
         54        MUL                                              ~60     !6, 3
         55        ADD                                              ~61     ~59, ~60
         56        MUL                                              ~62     !7, 4
         57        ADD                                              ~63     ~61, ~62
         58        MUL                                              ~64     !8, 5
         59        ADD                                              ~65     ~63, ~64
   29    60        MUL                                              ~66     !9, 6
         61        ADD                                              ~67     ~65, ~66
         62        MUL                                              ~68     !10, 7
         63        ADD                                              ~69     ~67, ~68
         64        MUL                                              ~70     !11, 8
         65        ADD                                              ~71     ~69, ~70
         66        MUL                                              ~72     !12, 9
         67        ADD                                              ~73     ~71, ~72
         68        MUL                                              ~74     !13, 10
         69        ADD                                              ~75     ~73, ~74
   28    70        ASSIGN                                                   !15, ~75
   32    71        MUL                                              ~77     !14, 10
         72        ASSIGN                                                   !16, ~77
   35    73        INIT_FCALL                                               'round'
         74        DIV                                              ~79     !15, !16
         75        MUL                                              ~80     ~79, 100
         76        MUL                                              ~81     ~80, 10
         77        SEND_VAL                                                 ~81
         78        DO_ICALL                                         $82     
         79        DIV                                              ~83     $82, 10
         80        ASSIGN                                                   !17, ~83
         81      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.58 ms | 1400 KiB | 15 Q