Forum Moderators: coopster
$number = 1234.56;
setlocale(LC_MONETARY,"en_US");
echo money_format("The price is %i", $number); The locale information is maintained per process, not per thread. ... you may experience sudden changes in locale settings while a script is runningbut honestly I think they're just trying to scare you. This is all happening within the same function, right? It's not as if your php is going to wander off, come back 5 minutes later and now you're in a whole new locale.
<?php echo $dk11;?> <?php setlocale(LC_MONETARY,'da_DK');echo money_format("%n",$dk11);?> // DK full prices
$dk11f = "499";
$dk12f = "999";
$dk21f = "699";
$dk22f = "1399";
// DK prices
$dk11 = "369";
$dk12 = "899";
$dk21 = "519";
$dk22 = "1299";
// DK discounts
$dk11d = $dk11f - $dk11;
$dk12d = $dk12f - $dk12;
$dk21d = $dk21f - $dk21;
$dk22d = $dk22f - $dk22; <?php echo $dk11;?> ...you may experience sudden changes in locale settings while a script is running
Each page that uses this is a single currency page
<?=getMoney($dk11)?>
$dk11 = "369";
<p><?php echo showDiscount($price11);?></p> <?php
include "prices-full.php";
// * Function to calculate discount
function showDiscount($priceVar) {
$fullVar = "$priceVar".'f';
$full = eval('return '.$fullVar.';');
$current = $priceVar;
echo $fullVar . "," . $current . "," . $full;
}
?>