What is the most efficient way to calculate discounts based on percentages in PHP?

When calculating discounts based on percentages in PHP, the most efficient way is to use the formula: discounted price = original price - (original price * discount percentage). This formula calculates the discounted price by subtracting the product of the original price and discount percentage from the original price.

$originalPrice = 100; // Original price before discount
$discountPercentage = 20; // Discount percentage
$discountedPrice = $originalPrice - ($originalPrice * ($discountPercentage / 100));

echo "Original Price: $" . $originalPrice . "\n";
echo "Discount Percentage: " . $discountPercentage . "%\n";
echo "Discounted Price: $" . $discountedPrice;