Upgrade to PHP for Calculated Merge Fields

Modified on Fri, 10 Mar 2023 at 12:12 PM

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


This article is a notice of that upgrade, an alternative to a widely used function that is deprecated in PHP 8.1, and a note about the next PHP upgrade for calculated merge fields.


Upgrade to PHP 8.1

PHP 8.1 offers increased:

  • Security
  • Performance
  • Stability
  • Support


This upgrade only affects 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.


Alternative for money_format() function

The primary change for Actionstep users is the removal of the money_format() function.


The money_format() function 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";


Future Upgrade

In PHP 8.1, the following functions have been deprecated.

  • strftime
  • date_sunrise
  • strptime
  • gmstrftime


In the next PHP version upgrade, these functions will be removed. If your calculation codes use these functions, they will not work once the next upgrade is implemented. 


Related Articles:

-  Calculated Merge Fields

-  Blacklisted/Whitelisted PHP for Calculated Merge Fields

 



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