Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Problem z algorytmem
robal94
post
Post #1





Grupa: Zarejestrowani
Postów: 150
Pomógł: 2
Dołączył: 14.06.2009
Skąd: Czestochowa

Ostrzeżenie: (0%)
-----


Witam! Napisałem algorytm na sortowanie zmiennych w tablicy.
  1. <?php
  2. $tablica[1]=$_POST['1'];
  3. $tablica[2]=$_POST['2'];
  4. $tablica[3]=$_POST['3'];
  5. $tablica[4]=$_POST['4'];
  6. $tablica[5]=$_POST['5'];
  7. $ilosc = count($tablica);
  8. $nr = 0;
  9. $nr2 = 1;
  10. echo $tablica[nr2];
  11. do{
  12. $wsp = 0;
  13. do{
  14. $nr++;
  15. $nr2++;
  16. if($tablica[$nr] > $tablica[$nr2])
  17. {
  18. $a = $tablica[$nr];
  19. $tablica[$nr] = $tablica[$nr2];
  20. $tablica[$nr2] = $a;
  21. $wsp++;
  22. }
  23.  
  24. }while( $nr != $ilosc );
  25. }while( $wsp != 0);
  26. $n=1;
  27. do {
  28. echo "<li>", $tablica[$n], "<br>";
  29. $n++;
  30. } while( $n <= 5 );
  31. echo '</UL>';
  32.  
  33. ?>


i wyskakuje mi błąd.


Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 33554432 bytes) in /home/epamiec/domains/e-pamiec.pl/public_html/1/koniec.php on line 20

Prosze o pomoc
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 06:42