SplInt
PHP Manual

SplInt::__construct

(PECL spl_types >= 0.1.0)

SplInt::__constructinteger 型のオブジェクトを作成する

説明

SplInt::__construct ( void )

これは、float 型の新しいオブジェクトを作成します。

パラメータ

input

input パラメータには integer 値を指定します。 それ以外を渡した場合は UnexpectedValueException をスローします。

返り値

値を返しません。

例1 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// Outputs 94
?>

上の例の出力は以下となります。

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


SplInt
PHP Manual
アダルトレンタルサーバー