How can one ensure that numbers in JSON are not converted to strings when using json_decode in PHP?

When using json_decode in PHP, numbers in JSON may be automatically converted to strings if they are large or have leading zeros. To ensure that numbers are not converted to strings, you can pass the JSON_BIGINT_AS_STRING option as the second parameter to json_decode. This option will force large numbers to be decoded as strings instead of floats.

$jsonString = '{"number": 12345678901234567890}';
$data = json_decode($jsonString, true, 512, JSON_BIGINT_AS_STRING);

var_dump($data['number']); // Outputs: string(20) "12345678901234567890"