Thanks for that… the errors are that the variables are not defined yet, as per the above example, it is saying that the $cost, $currency and $country variables have not been set yet.
<?php
declare(strict_types=1);
error_reporting(-1);
ini_set('display_errors', 'true');
# DEFAULTS
$cost = 'DEFAULT: 001';
$currency = 'DEFAULT: 002';
$country = 'DEFAULT: 003';
$countrycode = ' UK ';
$examplecontent = 'It is '
. $cost
. ' to buy this in '
. $currency
. ' to ship to your '
. $country . '.';
echo '<br>BEFORE: '
.'<br>$code ==> ' .$cost
.'<br>$currency ==> ' .$currency
.'<br>$country ==> ' .$country
.'<br>$countrycode ==> ' .$countrycode
.'<br>$examplecontent ==> ' .$examplecontent;
# REMOVE POSSIBLE SPACES
$countrycode = trim($countrycode);
if ($countrycode == "AU")
{
$cost = "$1";
$currency = "AUD";
$country = "Australia";
# echo (' ' . $examplecontent . '');
}
if ($countrycode == "UK")
{
$cost = "£1";
$currency = "GBP";
$country = "United Kingdom";
# echo (' ' . $examplecontent . '');
}
if ($countrycode == "US")
{
$cost = "$1";
$currency = "USD";
$country = "United States of America";
# echo (' ' . $examplecontent . '');
}
# FINISHED
$examplecontent = 'It is '
. $cost
. ' to buy this in '
. $currency
. ' to ship to your '
. $country . '.';
echo '<br><br>AFTER: '
.'<br>$code ==> ' .$cost
.'<br>$currency ==> ' .$currency
.'<br>$country ==> ' .$country
.'<br>$countrycode ==> ' .$countrycode
.'<br>$examplecontent ==> ' .$examplecontent;
**Output:**
```
BEFORE:
$code ==> DEFAULT: 001
$currency ==> DEFAULT: 002
$country ==> DEFAULT: 003
$countrycode ==> UK
$examplecontent ==> It is DEFAULT: 001 to buy this in DEFAULT: 002 to ship to your DEFAULT: 003.
AFTER:
$code ==> £1
$currency ==> GBP
$country ==> United Kingdom
$countrycode ==> UK
$examplecontent ==> It is £1 to buy this in GBP to ship to your United Kingdom.
<br>
**Edit:**
Added $examplecontent and amended defaults.