Freelance PHP programmer India | Freelance web developer india | Web development India | web developer CV india | Compiling PHP and Apache 2 from source on Linux
Variable handling Functions
PHP Manual

strval

(PHP 4, PHP 5)

strvalGet string value of a variable

Description

string strval ( mixed $var )

Get the string value of a variable. See the documentation on string for more information on converting to string.

Parameters

var

The variable that is being converted to a string.

var may be any scalar type. You cannot use strval() on arrays or objects.

Return Values

The string value of var .

Examples

Example #1 strval() example using PHP5's magic __toString method

<?php
class StrValTest
{
    public function 
__toString()
    {
        return 
__CLASS__;
    }
}

// Prints 'StrValTest'
echo strval(new StrValTest);
?>

See Also


Variable handling Functions
PHP Manual