3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(74.6779,25.918,44.9589); $total = array_sum($arr); $total_percentage = 0; foreach($arr as $total_item) { $percentage = ($total_item*100)/$total; $percentage = round($percentage,2); echo $percentage; echo "\n"; $total_percentage+=$percentage; } echo $total_percentage;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/079IH
function name:  (null)
number of ops:  23
compiled vars:  !0 = $arr, !1 = $total, !2 = $total_percentage, !3 = $total_item, !4 = $percentage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'array_sum'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
    6     5        ASSIGN                                                   !2, 0
    7     6      > FE_RESET_R                                       $9      !0, ->20
          7    > > FE_FETCH_R                                               $9, !3, ->20
    9     8    >   MUL                                              ~10     !3, 100
          9        DIV                                              ~11     ~10, !1
         10        ASSIGN                                                   !4, ~11
   11    11        INIT_FCALL                                               'round'
         12        SEND_VAR                                                 !4
         13        SEND_VAL                                                 2
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !4, $13
   12    16        ECHO                                                     !4
   13    17        ECHO                                                     '%0A'
   14    18        ASSIGN_OP                                     1          !2, !4
    7    19      > JMP                                                      ->7
         20    >   FE_FREE                                                  $9
   16    21        ECHO                                                     !2
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.96 ms | 1395 KiB | 17 Q