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

search for in the

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

view this page in

SplFloat::__construct

(PECL spl_types >= 0.1.0)

SplFloat::__constructConstruit un objet de type nombre décimal

Description

SplFloat::__construct ( float $input )

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

Liste de paramètres

input

Le paramètre input prend un float ou un integer. Si un integer est passé, il sera converti en float.

Valeurs de retour

Aucune valeur n'est retournée.

Exemples

Exemple #1 Exemple avec SplFloat::__construct()

<?php
$float    
= new SplFloat(3.154);
$newFloat = new SplFloat(3);

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

var_dump($float);
var_dump($newFloat);
?>

L'exemple ci-dessus va afficher :

Value not a float
object(SplFloat)#1 (1) {
  ["__default"]=>
  float(3.154)
}
object(SplFloat)#2 (1) {
  ["__default"]=>
  float(3)
}



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

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