以下是一个简单的PHP实例,演示如何根据不同的折扣率计算最终价格。
```php

// 定义原价
$originalPrice = 100.00;
// 定义折扣率
$discountRate = 0.20; // 20%折扣
// 计算折扣金额
$discountAmount = $originalPrice * $discountRate;
// 计算最终价格
$finalPrice = $originalPrice - $discountAmount;
// 输出结果
echo "
以下是一个简单的PHP实例,演示如何根据不同的折扣率计算最终价格。
```php

// 定义原价
$originalPrice = 100.00;
// 定义折扣率
$discountRate = 0.20; // 20%折扣
// 计算折扣金额
$discountAmount = $originalPrice * $discountRate;
// 计算最终价格
$finalPrice = $originalPrice - $discountAmount;
// 输出结果
echo "