Jump to content

Integer define ;S


quelle

Recommended Posts

Ive got a simple function that's counting percentages of the results, and what I want is when the first line does $variable / 100 - to go on 2 decimals(ex. 0.72142141 what I want is to write 0.72).

 

function postotak(){
$p = $bodovi / 100;
$postotak = $p * 100;

Link to comment
Share on other sites

the round function goes on an integer as i read 5 minutes ago, but if there is no other way it not a big deal rly ... (for ex. if $score = 60, $p=$score/110, $postotak=$p*100, $postotak = 54%). Btw my

function postotak(){
$p = $bodovi / 100;
$postotak = $p * 100;
$postotak = $postotak + "%";

return $postotak;
}

It does return nothing why  :confused:

Link to comment
Share on other sites

hmm lol look at this

function postotak($bodovi){
$p = $bodovi / 100;
$postotak = $p * 100;
$postotak = $postotak . "%";

return $postotak;
}

Warning: Missing argument 1 for postotak(), called in D:\xampp\htdocs\vjezbe\kviz - seica\rezultati.php on line 35 and defined in D:\xampp\htdocs\vjezbe\kviz - seica\rezultati.php on line 28 - THIS IS THE ERROR I GOT BY PASSING THE VARIABLE TO THE FUNCTION

 

28th line is the first line of this function

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.