What are some best practices for converting numbers from a non-standard format to a standard format in PHP?

When converting numbers from a non-standard format to a standard format in PHP, it's important to identify the pattern of the non-standard format and use appropriate functions to extract and manipulate the numbers. Regular expressions can be helpful in extracting numbers from strings with non-standard formats. Once the numbers are extracted, they can be formatted or manipulated as needed to convert them to a standard format.

// Example: Converting a non-standard decimal format (e.g. "1,234.56") to a standard decimal format (e.g. "1234.56")
$nonStandardNumber = "1,234.56";
$standardNumber = (float) str_replace(',', '', $nonStandardNumber);
echo $standardNumber; // Output: 1234.56