Help with currency display

Hello,

can somebody help me with this code?

Currently I have this code:

				    <ul class="quick-list quick-glance hideOnSearch ">
           				<?php	if (is_numeric( $fields['price'])){ echo '<li><p class="strong">'.$options['price_text'].':</p> '.$symbols['currency']; echo number_format($fields['price']).'</li>';}else {  echo '<li><p class="strong">'.$options['price_text'].':</p> '.$fields['price'].'<li>'; } ?> 

This provides output like this:

Cijena: Kn540000

I want the output to be like this:

Cijena: 54000 Kn

When I set code to:

<ul class="quick-list quick-glance hideOnSearch ">
           				<?php	if (is_numeric( $fields['price'])){ echo '<li><p class="strong">'.$options['price_text'].':</p> ' echo number_format($fields['price']).$symbols['currency'].'</li>';}else {  echo '<li><p class="strong">'.$options['price_text'].':</p> '.$fields['price'].'<li>'; } ?> 

Page is blank. What am I doing wrong?

If you get a blank page then you need to set your local development environment to display all errors. A blank page (where you do not expect one) is normally a web server configured for production use where you do not want such errors to show to the end user.

Hi, tnx for answer but I can’t do that. I just need to fix this code. Can you tell me what’s wrong with it when I make changes? Or you can’t without those details?

I just assign the variable for your understanding. May be will help you this below code.

<ul class="quick-list quick-glance hideOnSearch ">
<?php	

$fields['price'] = 540000; // replace your price
 $options['price_text'] = "Cijena"; // replace your price text
 $symbols['currency'] = 'Kn'; // replace your currency

 if (is_numeric( $fields['price'])) {
    echo '<li><p class="strong">'.$options['price_text'].' : ';
    echo number_format($fields['price'])." ".$symbols['currency'].'</p></li>';
}
else {  
    echo '<li><p class="strong">'.$options['price_text'].':</p> '.$fields['price'].'<li>'; 
} 
?>

// Output will be
Cijena : 540,000 Kn

Sponsor our Newsletter | Privacy Policy | Terms of Service