3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arreglo = array(34,2,7,1,90,45,87,23,10,8); //var_dump($arreglo); $mayor=null; $menor=null; function ordernar($a,$b) { if ($a>$b) return $b; else if ($b>=$a) return $a; } $limite = null; $ordenado = array(); $cantidad = count($arreglo); for ($i = 0; $i < $cantidad; $i++) { for ($j = $i+1; $j < $cantidad; $j++) { if (is_null($limite)) { if (is_null($menor)) $menor = ordernar($arreglo[$i],$arreglo[$j]); else if ($menor > ordernar($arreglo[$i],$arreglo[$j])) $menor = ordernar($arreglo[$i],$arreglo[$j]); }else { if (($limite==$arreglo[$i]) && ($arreglo[$i]<>$arreglo[$j])) { $menor = ordernar($arreglo[$j],$menor); } else if (($limite==$arreglo[$j]) && ($arreglo[$i]<>$arreglo[$j])) { $menor = ordernar($arreglo[$i],$menor); } else { if (is_null($menor)) $menor = ordernar($arreglo[$i],$arreglo[$j]); else if ($menor > ordernar($arreglo[$i],$arreglo[$j])) $menor = ordernar($arreglo[$i],$arreglo[$j]); } } } $limite = $menor; $ordenado = array_push($ordenado,$menor); $menor=null; } var_dump($ordenado);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 106
Branch analysis from position: 106
2 jumps found. (Code = 44) Position 1 = 108, Position 2 = 9
Branch analysis from position: 108
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 96
Branch analysis from position: 96
2 jumps found. (Code = 44) Position 1 = 98, Position 2 = 12
Branch analysis from position: 98
2 jumps found. (Code = 44) Position 1 = 108, Position 2 = 9
Branch analysis from position: 108
Branch analysis from position: 9
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 40
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 24
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 95
Branch analysis from position: 95
2 jumps found. (Code = 44) Position 1 = 98, Position 2 = 12
Branch analysis from position: 98
Branch analysis from position: 12
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 39
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 95
Branch analysis from position: 95
Branch analysis from position: 39
Branch analysis from position: 40
2 jumps found. (Code = 46) Position 1 = 43, Position 2 = 47
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 55
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 95
Branch analysis from position: 95
Branch analysis from position: 55
2 jumps found. (Code = 46) Position 1 = 58, Position 2 = 62
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 70
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 95
Branch analysis from position: 95
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 80
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 95
Branch analysis from position: 95
Branch analysis from position: 80
2 jumps found. (Code = 43) Position 1 = 88, Position 2 = 95
Branch analysis from position: 88
2 jumps found. (Code = 44) Position 1 = 98, Position 2 = 12
Branch analysis from position: 98
Branch analysis from position: 12
Branch analysis from position: 95
Branch analysis from position: 62
Branch analysis from position: 47
filename:       /in/OrSfo
function name:  (null)
number of ops:  112
compiled vars:  !0 = $arreglo, !1 = $mayor, !2 = $menor, !3 = $limite, !4 = $ordenado, !5 = $cantidad, !6 = $i, !7 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, null
    6     2        ASSIGN                                                   !2, null
   15     3        ASSIGN                                                   !3, null
   16     4        ASSIGN                                                   !4, <array>
   17     5        COUNT                                            ~13     !0
          6        ASSIGN                                                   !5, ~13
   18     7        ASSIGN                                                   !6, 0
          8      > JMP                                                      ->106
   19     9    >   ADD                                              ~16     !6, 1
         10        ASSIGN                                                   !7, ~16
         11      > JMP                                                      ->96
   20    12    >   TYPE_CHECK                                    2          !3
         13      > JMPZ                                                     ~18, ->40
   22    14    >   TYPE_CHECK                                    2          !2
         15      > JMPZ                                                     ~19, ->24
   23    16    >   INIT_FCALL                                               'ordernar'
         17        FETCH_DIM_R                                      ~20     !0, !6
         18        SEND_VAL                                                 ~20
         19        FETCH_DIM_R                                      ~21     !0, !7
         20        SEND_VAL                                                 ~21
         21        DO_FCALL                                      0  $22     
         22        ASSIGN                                                   !2, $22
   22    23      > JMP                                                      ->39
   25    24    >   INIT_FCALL                                               'ordernar'
         25        FETCH_DIM_R                                      ~24     !0, !6
         26        SEND_VAL                                                 ~24
         27        FETCH_DIM_R                                      ~25     !0, !7
         28        SEND_VAL                                                 ~25
         29        DO_FCALL                                      0  $26     
         30        IS_SMALLER                                               $26, !2
         31      > JMPZ                                                     ~27, ->39
   26    32    >   INIT_FCALL                                               'ordernar'
         33        FETCH_DIM_R                                      ~28     !0, !6
         34        SEND_VAL                                                 ~28
         35        FETCH_DIM_R                                      ~29     !0, !7
         36        SEND_VAL                                                 ~29
         37        DO_FCALL                                      0  $30     
         38        ASSIGN                                                   !2, $30
   20    39    > > JMP                                                      ->95
   29    40    >   FETCH_DIM_R                                      ~32     !0, !6
         41        IS_EQUAL                                         ~33     !3, ~32
         42      > JMPZ_EX                                          ~33     ~33, ->47
         43    >   FETCH_DIM_R                                      ~34     !0, !6
         44        FETCH_DIM_R                                      ~35     !0, !7
         45        IS_NOT_EQUAL                                     ~36     ~34, ~35
         46        BOOL                                             ~33     ~36
         47    > > JMPZ                                                     ~33, ->55
   31    48    >   INIT_FCALL                                               'ordernar'
         49        FETCH_DIM_R                                      ~37     !0, !7
         50        SEND_VAL                                                 ~37
         51        SEND_VAR                                                 !2
         52        DO_FCALL                                      0  $38     
         53        ASSIGN                                                   !2, $38
   29    54      > JMP                                                      ->95
   33    55    >   FETCH_DIM_R                                      ~40     !0, !7
         56        IS_EQUAL                                         ~41     !3, ~40
         57      > JMPZ_EX                                          ~41     ~41, ->62
         58    >   FETCH_DIM_R                                      ~42     !0, !6
         59        FETCH_DIM_R                                      ~43     !0, !7
         60        IS_NOT_EQUAL                                     ~44     ~42, ~43
         61        BOOL                                             ~41     ~44
         62    > > JMPZ                                                     ~41, ->70
   35    63    >   INIT_FCALL                                               'ordernar'
         64        FETCH_DIM_R                                      ~45     !0, !6
         65        SEND_VAL                                                 ~45
         66        SEND_VAR                                                 !2
         67        DO_FCALL                                      0  $46     
         68        ASSIGN                                                   !2, $46
   33    69      > JMP                                                      ->95
   39    70    >   TYPE_CHECK                                    2          !2
         71      > JMPZ                                                     ~48, ->80
   40    72    >   INIT_FCALL                                               'ordernar'
         73        FETCH_DIM_R                                      ~49     !0, !6
         74        SEND_VAL                                                 ~49
         75        FETCH_DIM_R                                      ~50     !0, !7
         76        SEND_VAL                                                 ~50
         77        DO_FCALL                                      0  $51     
         78        ASSIGN                                                   !2, $51
   39    79      > JMP                                                      ->95
   42    80    >   INIT_FCALL                                               'ordernar'
         81        FETCH_DIM_R                                      ~53     !0, !6
         82        SEND_VAL                                                 ~53
         83        FETCH_DIM_R                                      ~54     !0, !7
         84        SEND_VAL                                                 ~54
         85        DO_FCALL                                      0  $55     
         86        IS_SMALLER                                               $55, !2
         87      > JMPZ                                                     ~56, ->95
   43    88    >   INIT_FCALL                                               'ordernar'
         89        FETCH_DIM_R                                      ~57     !0, !6
         90        SEND_VAL                                                 ~57
         91        FETCH_DIM_R                                      ~58     !0, !7
         92        SEND_VAL                                                 ~58
         93        DO_FCALL                                      0  $59     
         94        ASSIGN                                                   !2, $59
   19    95    >   PRE_INC                                                  !7
         96    >   IS_SMALLER                                               !7, !5
         97      > JMPNZ                                                    ~62, ->12
   49    98    >   ASSIGN                                                   !3, !2
   50    99        INIT_FCALL                                               'array_push'
        100        SEND_REF                                                 !4
        101        SEND_VAR                                                 !2
        102        DO_ICALL                                         $64     
        103        ASSIGN                                                   !4, $64
   51   104        ASSIGN                                                   !2, null
   18   105        PRE_INC                                                  !6
        106    >   IS_SMALLER                                               !6, !5
        107      > JMPNZ                                                    ~68, ->9
   53   108    >   INIT_FCALL                                               'var_dump'
        109        SEND_VAR                                                 !4
        110        DO_ICALL                                                 
        111      > RETURN                                                   1

Function ordernar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OrSfo
function name:  ordernar
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        IS_SMALLER                                               !1, !0
          3      > JMPZ                                                     ~2, ->6
   10     4    > > RETURN                                                   !1
    9     5*       JMP                                                      ->9
   11     6    >   IS_SMALLER_OR_EQUAL                                      !0, !1
          7      > JMPZ                                                     ~3, ->9
   12     8    > > RETURN                                                   !0
   14     9    > > RETURN                                                   null

End of function ordernar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.76 ms | 1027 KiB | 23 Q