SplString
Streams
SplString
PHP Manual

# SplString::__construct

(PECL spl_types >= 0.1.0)

SplString::__construct — Constructs a string object type

### Descrição

SplString::__construct ( string `$input` )

This constructs a new object of type string.

### Parâmetros

`input`

  The `input` parameter accepts a string An UnexpectedValueException Exception will be thrown if anything else is passed.

### Valor Retornado

Não há valor retornado.

### Exemplos

Exemplo #1 SplString::__construct() example

`<?php
$string = new SplString("Testing");
try {
$string = array();
} catch (UnexpectedValueException $uve) {
echo $uve->getMessage() . PHP_EOL;
}
var_dump($string);
echo $string; // Outputs "Testing"
?>`

O exemplo acima irá imprimir:

    Value not a string
    object(SplString)#1 (1) {
      ["__default"]=>
      string(7) "Testing"
    }
    Testing

SplString
Streams
SplString
PHP Manual