SplInt
PHP 手册

SplInt::__construct

(No version information available, might be only in CVS)

SplInt::__constructConstructs an integer object type

说明

SplInt::__construct ( void )

This constructs a new object of type float.

参数

input

The input parameter accepts an integer An UnexpectedValueException Exception will be thrown if anything is passed.

返回值

无返回值。

范例

Example #1 SplInt::__construct() example

<?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 手册