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: Fri, 14 Jun 2013

view this page in

La classe SplInt

(PECL spl_types >= 0.1.0)

Introduction

La classe SplInt est utilisée pour assurer le typage fort du type integer.

Synopsis de la classe

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

Constantes pré-définies

SplInt::__default

Exemples

Exemple #1 Exemple d'utilisation de la classe SplInt

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

try {
    
$int 'Try to cast a string value for fun';
} catch (
UnexpectedValueException $uve) {
    echo 
$uve->getMessage() . PHP_EOL;
}

echo 
$int PHP_EOL;
?>

L'exemple ci-dessus va afficher :

Value not an 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