Are there any considerations to keep in mind when using functions like substr() in PHP for number manipulation?

When using functions like substr() in PHP for number manipulation, it's important to remember that substr() works with strings, not numbers. If you need to manipulate numbers, you should first convert them to strings before using substr(). This can be done using functions like strval() or (string).

// Example of converting a number to a string before using substr()
$number = 12345;
$numberString = strval($number);
$substring = substr($numberString, 0, 2);
echo $substring; // Output: 12