3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array ( "0" => 12 , "1" => 17 , "2" => 5, "3" => 27, "4" => 5 ); //$arrays = $array; $i=1; foreach($array as $key=>$values) { $max = max($array); echo "\n".max($array)." rank is ". $i."\n"; $keys = array_search(max($array), $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 = 37
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 37
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 36
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/0nRA3
function name:  (null)
number of ops:  39
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>
    6     1        ASSIGN                                                   !1, 1
    7     2      > FE_RESET_R                                       $8      !0, ->37
          3    > > FE_FETCH_R                                       ~9      $8, !2, ->37
          4    >   ASSIGN                                                   !3, ~9
    9     5        INIT_FCALL                                               'max'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $11     
          8        ASSIGN                                                   !4, $11
   10     9        INIT_FCALL                                               'max'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $13     
         12        CONCAT                                           ~14     '%0A', $13
         13        CONCAT                                           ~15     ~14, '+rank+is+'
         14        CONCAT                                           ~16     ~15, !1
         15        CONCAT                                           ~17     ~16, '%0A'
         16        ECHO                                                     ~17
   11    17        INIT_FCALL                                               'array_search'
         18        INIT_FCALL                                               'max'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                         $18     
         21        SEND_VAR                                                 $18
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $19     
         24        ASSIGN                                                   !5, $19
   12    25        UNSET_DIM                                                !0, !5
   13    26        COUNT                                            ~21     !0
         27        IS_SMALLER                                               0, ~21
         28      > JMPZ                                                     ~22, ->36
   14    29    >   INIT_FCALL                                               'in_array'
         30        SEND_VAR                                                 !4
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $23     
         33        BOOL_NOT                                         ~24     $23
         34      > JMPZ                                                     ~24, ->36
   15    35    >   PRE_INC                                                  !1
    7    36    > > JMP                                                      ->3
         37    >   FE_FREE                                                  $8
   17    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.24 ms | 1400 KiB | 19 Q