SplInt::__construct
(PECL spl_types >= 0.1.0)
SplInt::__construct — Construye un objecto del tipo integer
Descripción
SplInt::__construct()
(
integer
$input
)
Construye un nuevo objecto del tipo integer.
Parámetros
- input
-
El parámetro input solo acepta un integer Lanzará una excepción UnexpectedValueException si se pasa cualquier otro tipo.
Valores devueltos
No devuelve ningún valor.
Ejemplos
Example #1 Ejemplo SplInt::__construct()
<?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; // Devuelve 94
?>
El resultado del ejemplo sería:
Value not an integer
object(SplInt)#1 (1) {
["__default"]=>
int(94)
}
94
There are no user contributed notes for this page.
