vacis Posted August 10, 2005 Report Share Posted August 10, 2005 Vai kāds lūdzu var palīdzēt un pastāstīt, kā var noapaļot skaitļus, kas ir ar komatiem, piemēram, 12,34567 $kkk=($cipars/$ciparss); //$kkk sanaak 12,34567, bet vajag iegūt 12 //man sobrid nedarbojas starptautiskais, tapec nevaru citur pakonsulteties :( Link to comment Share on other sites More sharing options...
v3rb0 Posted August 10, 2005 Report Share Posted August 10, 2005 (edited) nevajag arzemes, pietiktu ar taadu graamatu kaa eng-lv vaardniica. pamegini $a = 12.3218455484841; round($a); tik skaties uz decimalo atdalitaju - php vajag punktu, ne komatu. Edited August 10, 2005 by v3rb0 Link to comment Share on other sites More sharing options...
Venom Posted August 10, 2005 Report Share Posted August 10, 2005 + floor(12.34)=12 ceil(12.34)=13 round(12.345,2)=12,35 Link to comment Share on other sites More sharing options...
vacis Posted August 10, 2005 Author Report Share Posted August 10, 2005 un kā būtu jāraksta, jai $a saturētu maksimums 3simbolus? Gadījumā, ja $a satur vairāk, tad liekos apgraizīt. Link to comment Share on other sites More sharing options...
vacis Posted August 10, 2005 Author Report Share Posted August 10, 2005 paldies! :) Link to comment Share on other sites More sharing options...
Analgiins Posted August 10, 2005 Report Share Posted August 10, 2005 var veel ar sprintf paspeeleeties: $num = 13.100; $format = sprintf("%01.2f", $num); // 13.10 Link to comment Share on other sites More sharing options...
Recommended Posts