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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.5 ms | 1405 KiB | 21 Q