GoLang strval

request it (422)
GoLang replacement for PHP's strval [edit | history]

Do you know a GoLang replacement for PHP's strval? Write it!

PHP strval

PHP original manual for strval [ show | php.net ]


(PHP 4, PHP 5, PHP 7)

strvalGet string value of a variable


string strval ( mixed $var )

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

This function performs no formatting on the returned value. If you are looking for a way to format a numeric value as a string, please see sprintf() or number_format().



The variable that is being converted to a string.

var may be any scalar type or an object that implements the __toString() method. You cannot use strval() on arrays or on objects that do not implement the __toString() method.

Return Values

The string value of var.


Example #1 strval() example using PHP 5's magic __toString() method.

class StrValTest
    public function 

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

See Also