3v4l.org

run code in 300+ PHP versions simultaneously
<?php $def = ["AF" => "Afghanistan", "AL" => "Albania", "DZ" => "Algeria", "AD" => "Andorra"]; $var = ["AF", "AF", "DZ"]; $countArr = array_count_values($var); $total = count($var); foreach ($countArr as $key => $count) { echo (100 * round($count / $total, 2)) . "% $def[$key]\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 24
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 24
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/taYri
function name:  (null)
number of ops:  26
compiled vars:  !0 = $def, !1 = $var, !2 = $countArr, !3 = $total, !4 = $count, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_count_values'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !2, $8
    7     6        COUNT                                            ~10     !1
          7        ASSIGN                                                   !3, ~10
    8     8      > FE_RESET_R                                       $12     !2, ->24
          9    > > FE_FETCH_R                                       ~13     $12, !4, ->24
         10    >   ASSIGN                                                   !5, ~13
    9    11        INIT_FCALL                                               'round'
         12        DIV                                              ~15     !4, !3
         13        SEND_VAL                                                 ~15
         14        SEND_VAL                                                 2
         15        DO_ICALL                                         $16     
         16        MUL                                              ~17     $16, 100
         17        ROPE_INIT                                     3  ~20     '%25+'
         18        FETCH_DIM_R                                      ~18     !0, !5
         19        ROPE_ADD                                      1  ~20     ~20, ~18
         20        ROPE_END                                      2  ~19     ~20, '%0A'
         21        CONCAT                                           ~22     ~17, ~19
         22        ECHO                                                     ~22
    8    23      > JMP                                                      ->9
         24    >   FE_FREE                                                  $12
   10    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.17 ms | 1011 KiB | 15 Q