Answer the question
In order to leave comments, you need to log in
How to multiply a variable by 100% in php?
I do this, it gives me an error:$result=$ipsa3*100%;
Answer the question
In order to leave comments, you need to log in
Multiply by 100%, apparently from the mentioned argument $ipsa3
like so:
$result = $ipsa3 * ((100 / 100) * $ipsa3);
// или просто
$result = $ipsa3 * $ipsa3;
$percent = 100; // сколько процентов
$result = $ipsa3 * (($percent / 100) * $ipsa3);
что-то * 0.5
$ipsa3
You can multiply numbers, not percentages. This is programming, not a calculator.
Doc: https://www.php.net/manual/en/language.operators.a...
Keep in mind that $ipsa3 must still be a number.
a percent is a hundredth, and 100 percent is 1,
respectively
$result = $ipsa3 * 1;
and it is better just $result = $ipsa3;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question