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

search for in the

SplFloat> <SplInt
Last updated: Fri, 14 Aug 2009

view this page in

SplInt::__construct

(PECL spl_types >= 0.1.0)

SplInt::__constructConstruit un objet de type integer

Description

SplInt::__construct ( integer $input )

Ce constructeur est utilisé pour attribuer et garantir le type de l'objet "Integer".

Liste de paramètres

input

Le paramètre input prend un integer et produit une exception UnexpectedValueException si autre donnée lui est passée.

Valeurs de retour

Aucune valeur n'est retournée.

Exemples

Exemple #1 Exemple avec SplInt::__construct()

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

try {
    
$int 'Essayez de transtyper une chaîne pour le fun';
} catch (
UnexpectedValueException $uve) {
    echo 
$uve->getMessage() . PHP_EOL;
}

var_dump($int);
echo 
$int// Affiche 94
?>

L'exemple ci-dessus va afficher :

Value not an integer
object(SplInt)#1 (1) {
  ["__default"]=>
  int(94)
}
94



add a note add a note User Contributed Notes
SplInt::__construct
There are no user contributed notes for this page.

SplFloat> <SplInt
Last updated: Fri, 14 Aug 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites