Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> rekurencja?
kicaj
post
Post #1





Grupa: Zarejestrowani
Postów: 1 640
Pomógł: 28
Dołączył: 13.02.2003
Skąd: Międzyrzecz/Poznań

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


  1. <?php
  2. class...
  3. {
  4.     function spr( $a, $b )
  5.     {
  6.         //jakies obliczenia...
  7.  
  8.        if( $b > $a ) 
  9.        {   
  10.             $this -> spr( $a, $b );
  11.        }
  12.     }
  13. }
  14. ?>
Chcialbym zeby to w mniejwiecej taki sposob dzialalo, ale nie wychodzi mi cos. Dokladnie chcialbym wykonywac az $b bedzie rowne, mniejsze $a (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Ten post edytował kicaj_ 4.03.2005, 17:59:14
Go to the top of the page
+Quote Post
ActivePlayer
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 1 224
Pomógł: 40
Dołączył: 6.07.2004
Skąd: Wuppertal

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


a obliczenia na 100% są dobre? postaraj sie stestowac na jakichs innych.
Go to the top of the page
+Quote Post
Vengeance
post
Post #3





Grupa: Zarejestrowani
Postów: 657
Pomógł: 2
Dołączył: 15.08.2003
Skąd: Łódź

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


"$b bedzie rowne, mniejsze $a"

no to chyba $b < $a
Go to the top of the page
+Quote Post
ActivePlayer
post
Post #4





Grupa: Przyjaciele php.pl
Postów: 1 224
Pomógł: 40
Dołączył: 6.07.2004
Skąd: Wuppertal

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


ale on wykonuje funkcje kiedy $b > $a czyli do momentu az $b == $a lub $b <$a
Go to the top of the page
+Quote Post
gruszek_
post
Post #5





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 21.02.2005

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


a nie lepiej poprostu while (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
  1. <?php
  2. function spr( $a, $b )
  3. {
  4.  while ($b > $a){
  5. //obliczenia 
  6.  }
  7. }
  8. ?>

(IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
Go to the top of the page
+Quote Post

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: 22.08.2025 - 12:57