3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); $a = [ [0,1, 2, 3, 4, 0, 5, 6, 4, 3, 2, 1,0], [0, 2, 3, 4, 0, 5, 6, 4, 3, 2, 0], [0, 3, 4, 0, 5, 6, 7,8,4, 3, 0], [-1,0,1,2,3,4,2,1,0,-1] ]; function getMin( $a ) { return min($a); } foreach ($a as $arr) { while( ( $arr != null ) ) { $arr = array_values(array_filter($arr)); if ($arr == null) { break; } $min = getMin( $arr ); foreach ($arr as &$e) { $e -= $min; } unset($e); echo join(" ",$arr),"\n"; } echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 37
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 37
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 7
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 17
2 jumps found. (Code = 125) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
2 jumps found. (Code = 126) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 7
Branch analysis from position: 35
Branch analysis from position: 7
Branch analysis from position: 25
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/Yf5CM
function name:  (null)
number of ops:  39
compiled vars:  !0 = $a, !1 = $arr, !2 = $min, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    4     3        ASSIGN                                                   !0, <array>
   17     4      > FE_RESET_R                                       $6      !0, ->37
          5    > > FE_FETCH_R                                               $6, !1, ->37
   18     6    > > JMP                                                      ->33
   19     7    >   INIT_FCALL                                               'array_values'
          8        INIT_FCALL                                               'array_filter'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !1, $8
   20    14        IS_EQUAL                                                 !1, null
         15      > JMPZ                                                     ~10, ->17
   21    16    > > JMP                                                      ->35
   23    17    >   INIT_FCALL                                               'getmin'
         18        SEND_VAR                                                 !1
         19        DO_FCALL                                      0  $11     
         20        ASSIGN                                                   !2, $11
   25    21      > FE_RESET_RW                                      $13     !1, ->25
         22    > > FE_FETCH_RW                                              $13, !3, ->25
   26    23    >   ASSIGN_OP                                     2          !3, !2
   25    24      > JMP                                                      ->22
         25    >   FE_FREE                                                  $13
   28    26        UNSET_CV                                                 !3
   29    27        INIT_FCALL                                               'join'
         28        SEND_VAL                                                 '+'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                         $15     
         31        ECHO                                                     $15
         32        ECHO                                                     '%0A'
   18    33    >   IS_NOT_EQUAL                                             !1, null
         34      > JMPNZ                                                    ~16, ->7
   31    35    >   ECHO                                                     '%0A'
   17    36      > JMP                                                      ->5
         37    >   FE_FREE                                                  $6
   32    38      > RETURN                                                   1

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

End of function getmin

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.14 ms | 1022 KiB | 19 Q