Use this code
$val = 270;
$percentage = 10;
$total = $val * 100 /(100 - $percentage);
$discount = $total - $val;
echo 'Total=".$total; // Total = 300
echo "Discount=".$discount; // Discount = 30
solved How to calculate an unknown total when you know the amount of the percent [closed]