Show currency sign in calc element

Folks

I have a calculate element that is working fine with the following code added to make it work

PHP:
$x=(float){maintenance___jobs_cost_agent}*{maintenance___job_agent_comm}/100+{maintenance___jobs_cost_agent};
return number_format($x,2);

I'm stuck on the last bit. The number it returns (for example) is 100.00 - How can I change the code to show the currency sign of my choice - e.g. ?100.00?

Thanks
 
Thanks Troester - I have just adjusted it to

PHP:
$x=(float){maintenance___jobs_cost_agent}*{maintenance___job_agent_comm}/100+{maintenance___jobs_cost_agent};
return sprintf("?%01.2f",$x,2);

...Which works fine but I will use yours as you are far better at this stuff than me and I trust your code not to break something :)
 
I would also have suggested the '?'. though I think you sprintf was fine and perhaps slightly more elegant.

S
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top