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:
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";
In PHP 8.1, the following functions have been deprecated.
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.
- Blacklisted/Whitelisted PHP for Calculated Merge Fields