1, 'EUR' => 0.8, 'GBP' => 0.7, 'JPY' => 110, ); $converted_amount = $amount * $exchange_rates[$to_currency] / $exchange_rates[$from_currency]; printf('%.2f %s is equivalent to %.2f %s', $amount, $from_currency, $converted_amount, $to_currency); ?>