is PHP crazy, or am I?
| From: | Christian Dechery | Date: | Sat, 08 Sep 2001 01:24:28 +0000 |
| Subject: | is PHP crazy, or am I? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-67294@lists.php.net to get a copy of this message | ||
whats wrong with the code below?
function bubblesort(&$vetor,$tam)
{
$trocou=true;
$i=$j=0;
while($trocou)
{
$trocou=false;
for($j=0; $j<$tam-$i; $j++)
{
if($vetor[$j] > $vetor[$j+1])
{
$aux=$vetor[$j];
$vetor[$j]=$vetor[$j+1];
$vetor[$j+1]=$aux;
} $i++;} } } it's right right? so why when I print the array (with a for(;;) or with print_r) it still shows me it's not ordered... I printed it INSIDE the function... what's the thing here? I'm I nuts? p.s: meu novo email é cdechery@easynet.com.br ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer