3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(0, 1, 2, 3, 4, 0, 5, 6, 4, 3, 2, 1,0); function getMin( $a ) { $arr_filtered = array_values(array_filter( $a )); return min($arr_filtered); } $min = getMin( $arr ); $count = count($arr); while( count( array_unique($arr) ) > 1 ) { for( $i = 0; $i < $count; $i++) { if( $arr[$i] >= $min ){ $arr[$i] -= $min; echo $arr[$i]." "; } } echo "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 8
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 8
Branch analysis from position: 28
Branch analysis from position: 8
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
Branch analysis from position: 10
Branch analysis from position: 18
filename:       /in/87hJ6
function name:  (null)
number of ops:  29
compiled vars:  !0 = $arr, !1 = $min, !2 = $count, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'getmin'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $5      
          4        ASSIGN                                                   !1, $5
   13     5        COUNT                                            ~7      !0
          6        ASSIGN                                                   !2, ~7
   15     7      > JMP                                                      ->22
   18     8    >   ASSIGN                                                   !3, 0
          9      > JMP                                                      ->19
   20    10    >   FETCH_DIM_R                                      ~10     !0, !3
         11        IS_SMALLER_OR_EQUAL                                      !1, ~10
         12      > JMPZ                                                     ~11, ->18
   21    13    >   ASSIGN_DIM_OP                -=               2          !0, !3
         14        OP_DATA                                                  !1
   22    15        FETCH_DIM_R                                      ~13     !0, !3
         16        CONCAT                                           ~14     ~13, '+'
         17        ECHO                                                     ~14
   18    18    >   PRE_INC                                                  !3
         19    >   IS_SMALLER                                               !3, !2
         20      > JMPNZ                                                    ~16, ->10
   25    21    >   ECHO                                                     '%0A'
   15    22    >   INIT_FCALL                                               'array_unique'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $17     
         25        COUNT                                            ~18     $17
         26        IS_SMALLER                                               1, ~18
         27      > JMPNZ                                                    ~19, ->8
   26    28    > > RETURN                                                   1

Function getmin:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/87hJ6
function name:  getMin
number of ops:  13
compiled vars:  !0 = $a, !1 = $arr_filtered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'array_values'
          2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !1, $3
    7     8        INIT_FCALL                                               'min'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $5      
         11      > RETURN                                                   $5
    9    12*     > RETURN                                                   null

End of function getmin

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.89 ms | 1021 KiB | 18 Q