<?php
$int = new SplInt(94);
try {
$int = 'Try to cast a string value for fun';
} catch (UnexpectedValueException $uve) {
echo $uve->getMessage() . PHP_EOL;
}
var_dump($int);
echo $int; // Outputs 94
?>
The above example will output:
Value not an integer
object(SplInt)#1 (1) {
["__default"]=>
int(94)
}
94