I am doing an equation and the outcome is 45.454545454545454545.
I would like to get rid of the 45454545 after the decimal point. and have 45%
$final=5/11*100;
I am doing an equation and the outcome is 45.454545454545454545.
I would like to get rid of the 45454545 after the decimal point. and have 45%
$final=5/11*100;
you need to use the PHP int() function:
$final=5/11*100;
$integer = (int)$final;
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.