3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array ( "0" => 12 , "1" => 17 , "2" => 65, "3" => 27, "4" => 5 ); $i=1; foreach($array as $key=>$values) { $max = max($array); echo "\n".$max." rank is ". $i."\n"; $keys = array_search($max, $array); unset($array[$keys]); if(sizeof($array) >0) if(!in_array($max,$array)) $i++; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 31
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 31
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 30
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 30
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 30
Branch analysis from position: 30
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/eNgC8
function name:  (null)
number of ops:  33
compiled vars:  !0 = $array, !1 = $i, !2 = $values, !3 = $key, !4 = $max, !5 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, 1
    6     2      > FE_RESET_R                                       $8      !0, ->31
          3    > > FE_FETCH_R                                       ~9      $8, !2, ->31
          4    >   ASSIGN                                                   !3, ~9
    8     5        INIT_FCALL                                               'max'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $11     
          8        ASSIGN                                                   !4, $11
    9     9        CONCAT                                           ~13     '%0A', !4
         10        CONCAT                                           ~14     ~13, '+rank+is+'
         11        CONCAT                                           ~15     ~14, !1
         12        CONCAT                                           ~16     ~15, '%0A'
         13        ECHO                                                     ~16
   10    14        INIT_FCALL                                               'array_search'
         15        SEND_VAR                                                 !4
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $17     
         18        ASSIGN                                                   !5, $17
   11    19        UNSET_DIM                                                !0, !5
   12    20        COUNT                                            ~19     !0
         21        IS_SMALLER                                               0, ~19
         22      > JMPZ                                                     ~20, ->30
   13    23    >   INIT_FCALL                                               'in_array'
         24        SEND_VAR                                                 !4
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                         $21     
         27        BOOL_NOT                                         ~22     $21
         28      > JMPZ                                                     ~22, ->30
   14    29    >   PRE_INC                                                  !1
    6    30    > > JMP                                                      ->3
         31    >   FE_FREE                                                  $8
   16    32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.21 ms | 1396 KiB | 19 Q