G-Style Posted December 8, 2007 Report Share Posted December 8, 2007 Kaa sitajam var noaplaot ciparus aiz komata,vai arii raadiit tikai piem. 4 ciparus aiz komata? Link to comment Share on other sites More sharing options...
gurkjis Posted December 8, 2007 Report Share Posted December 8, 2007 printf("%s %s = %.2F LVL<br>", $element['Units'], $element['ID'], $element['Rate']); iekš "%.2F" divnieka vietā var ielikt citu skaitli, kas norāda, cik nulles būs aiz komata. Link to comment Share on other sites More sharing options...
G-Style Posted December 8, 2007 Author Report Share Posted December 8, 2007 Darbojas! Paldies! Un kaa katrai valuutai piesaistiit klaat kaadu mazu valsts karogu, lai raada prieksaa katrai rindai? Link to comment Share on other sites More sharing options...
andrisp Posted December 8, 2007 Report Share Posted December 8, 2007 Uzrakstot attiecīgo kodu. Jeb jautā konkrētākus jautājumus. Link to comment Share on other sites More sharing options...
G-Style Posted December 8, 2007 Author Report Share Posted December 8, 2007 (edited) Gribu, lai izvadot katru rindu tai tiek piesaistiits kaads *.jpg fails pie, USD =>> usd.gif, RUB =>> rub.gif piemeers sheit. Edited December 8, 2007 by G-Style Link to comment Share on other sites More sharing options...
Aleksejs Posted December 8, 2007 Report Share Posted December 8, 2007 printf("<img src=\"%s\.gif" />%s %s = %.2F LVL<br>", $element['Units'], $element['Units'], $element['ID'], $element['Rate']); Kaut kā tā... Link to comment Share on other sites More sharing options...
Kavacky Posted December 8, 2007 Report Share Posted December 8, 2007 Nafig kaut kādu printf lietot, ja ir normāls echo un round()? Link to comment Share on other sites More sharing options...
NiTrino Posted December 8, 2007 Report Share Posted December 8, 2007 round neder valūtas izvadīšanai. vēl var izmantot number_format() Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 9, 2007 Report Share Posted December 9, 2007 Kavacky --> saja gadijuma optimali ir izvadit ar printf() krietni ertak un arii parskatamak.... + round() noapaljo skaitli , nevis parada tikai noteiktu skaitu aiz komata .... ka jau NiTrino varetu vel izmantot number_format() ... vispar izvadot lielus skaitljus ir jauzmanas PHP medz nogljukot un izvadiit nepareizi .... (precizak nevar panjemt lielu floot...) $a=900000000.1234567890; // 900 ' 000 ' 000 --> Devinsimt miljoni ar precizitati liidz 10 zimei ... echo $a.'<br>'; $b=number_format($a,9); echo $b.'<br>'; printf(" %.9F ", $a); Uzmieniet kaads buus izvadamais rezultaats? pamainiet skaitljus --> tad redzes kadi brinumi notiek.... Link to comment Share on other sites More sharing options...
bubu Posted December 9, 2007 Report Share Posted December 9, 2007 Autors tak prasīja noapaļot skaitli ar noteiktiem cipariem aiz komata. Tā ka round ir īstā funkcija, kas jāņem. Kāpēc lai tā nederētu? Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 9, 2007 Report Share Posted December 9, 2007 Tā ka round ir īstā funkcija, kas jāņem. Kāpēc lai tā nederētu? Idejiski jau der, Bet talak autors konkreti norada kaadam merkjim tas buus domats --> Valutas izvadisanai --> taatad round() nederes... tieshi tadelj ka noapaljo, nevis tikai attelo.... IMPHO diezvai kadam patiks kad valutas cena tiks noapaljota .... nevis vienk paraditas 4 zimes aiz komata.... Link to comment Share on other sites More sharing options...
andrisp Posted December 9, 2007 Report Share Posted December 9, 2007 IMPHO diezvai kadam patiks kad valutas cena tiks noapaljota .... nevis vienk paraditas 4 zimes aiz komata.... Nu nez - man liekas normāli. Pats cik esmu taisījis, tā ir parasta prasība, ka ja nu gadijumā aprēķinot kaut kādas kopsummas, skaitlis sanāk ar daudziem cipariem aiz komata, tad vajag noapaļot. Link to comment Share on other sites More sharing options...
G-Style Posted December 9, 2007 Author Report Share Posted December 9, 2007 printf("<img src=\"%s\.gif" />%s %s = %.2F LVL<br>", $element['Units'], $element['Units'], $element['ID'], $element['Rate']); Kaut kā tā... Sitas nedarbojas, raada blank lapu :( Link to comment Share on other sites More sharing options...
bubu Posted December 9, 2007 Report Share Posted December 9, 2007 Ieslēdz kļūdu apstrādi (error_reporting, display_errors), kā arī apskati lapas sourci, ja neredz kļūdas browserī. Link to comment Share on other sites More sharing options...
G-Style Posted December 9, 2007 Author Report Share Posted December 9, 2007 (edited) kluudas nekaadas neizmet, source tuksa. Edited December 9, 2007 by G-Style Link to comment Share on other sites More sharing options...
Recommended Posts