<?php echo (($priceInt[0]-$specialInt[0])/$priceInt[0])*100 ?>
For every price this gives me something like 11,111111111 or 3,3433333333 How can i limit it so i will get only 11 or 3 ? Without anything after " , ".
Take a look at http://php.net/manual/fr/function.number-format.php
Use it like this :
echo number_format((($priceInt[0]-$specialInt[0])/$priceInt[0])*100, 0, '', '');
If you just need the integer part just use :
echo intval((($priceInt[0]-$specialInt[0])/$priceInt[0])*100);
You can use sprintf() like below:
echo sprintf("%d",'3,3433333333'); //output : 3
or
echo sprintf("%d",'11,111111111'); //output : 11
In your case:
echo sprintf("%d",((($priceInt[0]-$specialInt[0])/$priceInt[0])*100));
Thanks a lot guys i fixed it
echo sprintf("%d",((($priceInt-$specialInt)/$priceInt)*100));