سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top