In this article, you will learn how to get the string value of the variable in PHP. The strval() function in PHP returns the string value of a variable.
what is the syntax of the STRVAL() function in php?
strval(variable);
Parameters | Details |
---|---|
variable | Required. Specifies the variable to check |
examples of the STRVAL() function
Example 1. In this example, we 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>";
?>