downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

SplFloat> <SplType::__construct
[edit] Last updated: Wed, 19 Jun 2013

view this page in

La clase SplInt

(PECL spl_types >= 0.1.0)

Introducción

La clase SplInt se utiliza para hacer cumplir el uso correcto del tipo de dato integer.

Sinopsis de la Clase

SplInt extends SplType {
/* Constantes */
const integer __default = 0 ;
/* Métodos heredados */
SplType::__construct ([ mixed $initial_value [, bool $strict ]] )
}

Constantes predefinidas

SplInt::__default

Ejemplos

Ejemplo #1 Ejemplo de uso de SplInt

<?php
$int 
= new SplInt(94);

try {
    
$int 'Intente hacer casteo a un valor string sólo por diversión';
} catch (
UnexpectedValueException $uve) {
    echo 
$uve->getMessage() . PHP_EOL;
}

echo 
$int PHP_EOL;
?>

El resultado del ejemplo sería:

El valor no es un integer
94



add a note add a note User Contributed Notes SplInt - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites