Numeric Separators Inside A String?ΒΆ
Since PHP 7.4, there are numeric separators, to make integers more readable.
They are only for hard-coded literals, so what do you do if you have stored them in a string ?
The solution is to rely on eval(), with a trick : $int = eval('return '.$a.';');
. return
is important to return the value that was generated by the code.
Another option is to remove the _ chars, and cast the value to int.