note 36516 added to function.sort

From: Date: Mon, 13 Oct 2003 13:09:16 +0000
Subject: note 36516 added to function.sort
Groups: php.notes 
Request: Send a blank email to php-notes+get-58533@lists.php.net to get a copy of this message
A simple sort 2 array 1D (bublesort) <?php // init var $tam = sizeof($arr ) ; $i=0; $aux=0; $change = true; // the sort while( $i<$tam && $change ): $j=0; $troca = false; while( $j < $tam-$i-1 ): if( $arr[$j] > $arr[$j+1] ): $aux = $arr[$j]; $arr[$j] = $arr[$j+1]; $arr[$j+1] = $aux; $troca = true; endif; $j++; endwhile; $i++; endwhile; ?> ---- Manual Page -- http://www.php.net/manual/en/function.sort.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36516 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36516&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36516&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#58533) next »