Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> jak majac liczbe x wygenerowac dopelnienie do peln
T-rex
post
Post #1





Grupa: Zablokowani
Postów: 34
Pomógł: 0
Dołączył: 27.03.2004

Ostrzeżenie: (20%)
X----


mam liczbe x, i chce miec kolejne dopelnienia do 10, np mam 7 to pokazuje mi 10 , mam 23 to pokazuje 30 mam 100 to pokazuje 110 120 130, mam 20 pokazuje 30, mam 41 pokazuje 50 etc. Chyba zrozumielisice mnie (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Ten post edytował T-rex 20.01.2005, 22:39:53
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
hwao
post
Post #2


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




  1. <?php
  2. function up( $int )
  3. {
  4. $x = ceil( $int / 10 );
  5. if( ( $int % 10 ) == 0 ) 
  6. {
  7.  return $x * 10 +10;
  8. }else{
  9.  return $x * 10;
  10. }
  11.  
  12. echo up( 10 );
  13. ?>

Powino byc ok ale glowy nie dam
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: 9.10.2025 - 01:03