Upgrade to PHP for Calculated Merge Fields

Modified on Wed, 05 Jun 2024 at 02:07 PM

Actionstep upgraded the version of PHP used for Calculated Merge Fields to 8.1 in early 2023.


PHP 8.1 offers increased:

  • Security
  • Performance
  • Stability
  • Support


This upgrade only affected the version of PHP supported for use in Calculated Merge Fields. As such, some of your fields may need to be updated to code supported in PHP 8.1.


Additionally, this upgrade removed of the money_format() function, which returns a string formatted as a currency string.  This function was deprecated in PHP 7.4 and removed in 8.0. Below are examples of a typical implementation of money_format() and a code to replace it.


 

NOTE: In the codes below, $variable is in place of the number to be formatted. This could be a number from an Actionstep merge field used in your calculation or a numeric value, e.g. 123.45


Previous code example:

money_format ('%#4n',$variable) ;


To replace the money_format() function, you can use the NumberFormatter class


New code example: 

$fmt = numfmt_create( 'en_EN', NumberFormatter::CURRENCY ); 

echo numfmt_format_currency($fmt, $variable, "USD")."\n";


Finally, in PHP 8.1, the following functions were deprecated.

  • strftime
  • date_sunrise
  • strptime
  • gmstrftime


In PHP version upgrades after 8.1, these functions may have been removed. If your calculation codes use these functions, they may not work after the next upgrade was implemented. 


Related Articles:

 



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article