Home > Blockchain >  How can i use the percent symbol to calculate number in php
How can i use the percent symbol to calculate number in php

Time:06-07

this is the code

$result = ($Y*$Z*$V ($Y*$Z*$V*($B*2.75%)) (($Y*$Z*$V*($N*1.37%))));

i'm trying to have a calculation value in result variable this code is having error at the parentheses after the percent symbol i guess i can't use the percent symbol. is there anyway to have percent symbol without error?

CodePudding user response:

In PHP you can't use the symbol % as a percentage, because % is the modulo operator.

If you wanna using percentage try 2.75% into (2.75/100) so change like these:

$result = ($Y*$Z*$V ($Y*$Z*$V*($B*(2.75/100)) (($Y*$Z*$V*($N*(1.37/100)))));

CodePudding user response:

$result = ($Y*$Z*$V ($Y*$Z*$V*($B*2.75\%)) (($Y*$Z*$V*($N*1.37\%))));

Use This It will work.

  •  Tags:  
  • php
  • Related