3v4l.org

run code in 300+ PHP versions simultaneously
<?php function aff($t){ for($i=0;$i<count($t);$i++){ echo $t[$i]." "; } echo "<br />"; } function tablTrie($t){ for($i=0; $i < count($t)-1; $i++){ if($t[$i]>$t[$i+1]){return false;} } return true; } function trier(&$t){ if(!tablTrie($t)){trier2($t);} } function permuter (&$t,$i,$j){ $save=$t[$i]; $t[$i]=$t[$j]; $t[$j]=$save; } function trier2($t){ $u=0; for($i=0;$i<count($t)-1;$i++){ while($t[$i]>$t[$i+1]){ if($t[$i]<$t[$u]){$u=$u+1;} permuter($t,$u,$i); } } } //exemple d'appel $t=array(1,2,11,24,19,28,12,16,3,4,5,6,7,8,9,10); aff($t). "<br>"; trier($t); aff($t). "<br>"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8s3Oq
function name:  (null)
number of ops:  15
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   ASSIGN                                                   !0, <array>
   40     1        INIT_FCALL                                               'aff'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        CONCAT                                           ~3      $2, '%3Cbr%3E'
          5        FREE                                                     ~3
   41     6        INIT_FCALL                                               'trier'
          7        SEND_REF                                                 !0
          8        DO_FCALL                                      0          
   42     9        INIT_FCALL                                               'aff'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0  $5      
         12        CONCAT                                           ~6      $5, '%3Cbr%3E'
         13        FREE                                                     ~6
   45    14      > RETURN                                                   1

Function aff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/8s3Oq
function name:  aff
number of ops:  12
compiled vars:  !0 = $t, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->7
    5     3    >   FETCH_DIM_R                                      ~3      !0, !1
          4        CONCAT                                           ~4      ~3, '+'
          5        ECHO                                                     ~4
    4     6        PRE_INC                                                  !1
          7    >   COUNT                                            ~6      !0
          8        IS_SMALLER                                               !1, ~6
          9      > JMPNZ                                                    ~7, ->3
    7    10    >   ECHO                                                     '%3Cbr+%2F%3E'
    8    11      > RETURN                                                   null

End of function aff

Function tabltrie:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
Branch analysis from position: 3
filename:       /in/8s3Oq
function name:  tablTrie
number of ops:  16
compiled vars:  !0 = $t, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->10
   12     3    >   FETCH_DIM_R                                      ~3      !0, !1
          4        ADD                                              ~4      !1, 1
          5        FETCH_DIM_R                                      ~5      !0, ~4
          6        IS_SMALLER                                               ~5, ~3
          7      > JMPZ                                                     ~6, ->9
          8    > > RETURN                                                   <false>
   11     9    >   PRE_INC                                                  !1
         10    >   COUNT                                            ~8      !0
         11        SUB                                              ~9      ~8, 1
         12        IS_SMALLER                                               !1, ~9
         13      > JMPNZ                                                    ~10, ->3
   14    14    > > RETURN                                                   <true>
   15    15*     > RETURN                                                   null

End of function tabltrie

Function trier:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/8s3Oq
function name:  trier
number of ops:  10
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'tabltrie'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $1      
          4        BOOL_NOT                                         ~2      $1
          5      > JMPZ                                                     ~2, ->9
          6    >   INIT_FCALL_BY_NAME                                       'trier2'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   19     9    > > RETURN                                                   null

End of function trier

Function permuter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8s3Oq
function name:  permuter
number of ops:  11
compiled vars:  !0 = $t, !1 = $i, !2 = $j, !3 = $save
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   22     3        FETCH_DIM_R                                      ~4      !0, !1
          4        ASSIGN                                                   !3, ~4
   23     5        FETCH_DIM_R                                      ~7      !0, !2
          6        ASSIGN_DIM                                               !0, !1
          7        OP_DATA                                                  ~7
   24     8        ASSIGN_DIM                                               !0, !2
          9        OP_DATA                                                  !3
   25    10      > RETURN                                                   null

End of function permuter

Function trier2:
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 = 26, Position 2 = 4
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 5
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 4
Branch analysis from position: 26
Branch analysis from position: 4
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 5
Branch analysis from position: 21
Branch analysis from position: 5
Branch analysis from position: 11
filename:       /in/8s3Oq
function name:  trier2
number of ops:  27
compiled vars:  !0 = $t, !1 = $u, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   28     1        ASSIGN                                                   !1, 0
   29     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->22
   30     4    > > JMP                                                      ->16
   31     5    >   FETCH_DIM_R                                      ~5      !0, !2
          6        FETCH_DIM_R                                      ~6      !0, !1
          7        IS_SMALLER                                               ~5, ~6
          8      > JMPZ                                                     ~7, ->11
          9    >   ADD                                              ~8      !1, 1
         10        ASSIGN                                                   !1, ~8
   32    11    >   INIT_FCALL                                               'permuter'
         12        SEND_REF                                                 !0
         13        SEND_VAR                                                 !1
         14        SEND_VAR                                                 !2
         15        DO_FCALL                                      0          
   30    16    >   FETCH_DIM_R                                      ~11     !0, !2
         17        ADD                                              ~12     !2, 1
         18        FETCH_DIM_R                                      ~13     !0, ~12
         19        IS_SMALLER                                               ~13, ~11
         20      > JMPNZ                                                    ~14, ->5
   29    21    >   PRE_INC                                                  !2
         22    >   COUNT                                            ~16     !0
         23        SUB                                              ~17     ~16, 1
         24        IS_SMALLER                                               !2, ~17
         25      > JMPNZ                                                    ~18, ->4
   35    26    > > RETURN                                                   null

End of function trier2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.37 ms | 1407 KiB | 18 Q