array mit negativen werten sortieren

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • array mit negativen werten sortieren

    ich will nen array folgendermaßen sortieren:
    167,86,10,3,0,-7,-19,-178

    natsort sortiert die negativen zahlen verkehrt also zb 6,0,-50,-7,-1

    konnte nichts finden das die zahlen "richtig" ihrer größe nach sortiert.

  • #2
    rsort oder arsort?

    Comment


    • #3
      ich will ja nicht von hinten rein sortieren auserdem sortiert rsort / arsort imho 44, 4, 3, 27, 2, 18, 1 ...

      Comment


      • #4
        Wissen != Glauben
        PHP Code:
        <pre>
        <?php
        $a 
        = array(167,86,10,3,0,-7,-19,-178);
        rsort($a);
        print_r($a);
        ?>
        </pre>

        Comment


        • #5
          ok sry dann ist das wohl nur bei strings so mit sort ^^

          danke

          Comment

          Working...
          X