Numeric Separators Inside A String?

no-email (Damien Seguy), Damien Seguy
Thu, 24 Aug 2023 00:00:00 +0000

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.