[PHP] is PHP crazy, or am I?
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 é [EMAIL PROTECTED] . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] is PHP crazy, or am I?
maybe I'm wrong, but don't you need a return value? - Original Message - From: Christian Dechery [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, September 08, 2001 2:24 AM Subject: [PHP] is PHP crazy, or am I? 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 é [EMAIL PROTECTED] . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] is PHP crazy, or am I?
So sprach »Tom Carter« am 2001-09-14 um 03:58:50 +0100 : maybe I'm wrong, but don't you need a return value? No, he doesn't . Have a look at the 1st parameter. PS: Fullquotes are not necessary. Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 23 hours 47 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]