How can substr() and strrev() functions in PHP be utilized to manipulate and format numerical data effectively?

To manipulate and format numerical data effectively using substr() and strrev() functions in PHP, you can extract specific parts of a number and reverse its digits. For example, you can extract the last few digits of a number or reverse the entire number to create a new format.

// Extracting the last 3 digits of a number
$number = 123456789;
$lastThreeDigits = substr($number, -3);

echo $lastThreeDigits; // Outputs: 789

// Reversing a number
$number = 12345;
$reversedNumber = (int)strrev((string)$number);

echo $reversedNumber; // Outputs: 54321