SplString
PHP Manual

SplString::__construct

(PECL spl_types >= 0.1.0)

SplString::__constructConstruit un objet de type chaîne

Description

SplString::__construct() ( string $input )

Construit un objet de type chaîne.

Liste de paramètres

input

Le paramètre input accepte une chaîne de caractères Une exception UnexpectedValueException est émise si un problème survient.

Valeurs de retour

Aucune valeur n'est retournée.

Exemples

Exemple #1 Exemple avec SplString::__construct()

<?php
$string 
= new SplString("Test");

try {
    
$string = array();
} catch (
UnexpectedValueException $uve) {
    echo 
$uve->getMessage() . PHP_EOL;
}

var_dump($string);
echo 
$string// Outputs "Test"
?>

L'exemple ci-dessus va afficher :

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


SplString
PHP Manual