PHP strval() Function

❮ PHP Variable Handling Reference

Example

Return the string value of different variables:

<?php
$a = "Hello";
echo strval($a) . "<br>";

$b = "1234.56789";
echo strval($b) . "<br>";

$c = "1234.56789Hello";
echo strval($c) . "<br>";

$d = "Hello1234.56789";
echo strval($d) . "<br>";

$e = 1234;
echo strval($e) . "<br>";
?>
Try it Yourself »

Definition and Usage

The strval() function returns the string value of a variable.


Syntax

strval(variable);

Parameter Values

Parameter Description
variable Required. Specifies the variable to check

Technical Details

Return Value: The string value of the variable on success
Return Type: String
PHP Version: 4.0+

❮ PHP Variable Handling Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.