以下是一个简单的PHP实例,用于计算商品打折后的价格。该实例假设有一个原始价格和折扣率,然后计算出折扣后的价格。
```php

// 商品原始价格
$originalPrice = 100.00;
// 折扣率(例如,20%的折扣,则输入0.20)
$discountRate = 0.20;
// 计算折扣金额
$discountAmount = $originalPrice * $discountRate;
// 计算折扣后的价格
$discountedPrice = $originalPrice - $discountAmount;
// 输出结果
echo "









