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

search for in the

Streams> <SplString
Last updated: Fri, 20 Nov 2009

view this page in

SplString::__construct

(PECL spl_types >= 0.1.0)

SplString::__constructConstructs a string object type

Description

SplString::__construct ( string $input )

This constructs a new object of type string.

Parameters

input

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

Return Values

No value is returned.

Examples

Example #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"
?>

The above example will output:

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



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

Streams> <SplString
Last updated: Fri, 20 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites