Question

Im having trouble with this code - getting a 500 error, I need to format as currency for the values in an array. But getting stuck:

If I use round() - it will work - but it just rounds the number, which is not what Im after.

$cart[] = array('name' => $message->name, 'values' => array(round($delivery->revenue), $delivery->uniqConversions));

But if I try to use money_format, it does not work:

$cart[] = array('name' => $message->name, 'values' => array(money_format('$%i', ($delivery->revenue), $delivery->uniqConversions));

Any Ideas?

Was it helpful?

Solution

Its because you are missing ) at the end of your line:

$cart[] = array('name' => $message->name, 'values' => array(money_format('$%i', ($delivery->revenue), $delivery->uniqConversions)));

Thats why you are getting Error 500.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top