$i=100;
$str=strval($i);
print("The string value of the integer '".$i."' is '".$str."'\r\n");
$f=1.55;
$str=strval($f);
print("The string value of the float '".$f."' is '".$str."'\r\n");
$s="100 dollars"
print("The string value of the string '".$s."' is '".strval($s)."'\r\n");
$arr1=array(); // empty array
print("strval($arr1)='".strval($arr1)."'\r\n");
$arr2=array("1","2","3"); // array with values
print("strval($arr2)='".strval($arr2)."'\r\n");
?>
The above example will output:
The string value of the integer '100' is '100'
The string value of the float '1.550000' is '1.550000'
The string value of the string '100 dollars' is '100 dollars'
strval($arr1)=''
strval($arr2)=''
====Note====
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:
[[number_format()]] - Format the number with the specified number of digits of precision
[[print(f)]] - Print a formatted string to standard output
[[sprintf()]] - Return a formatted string
[[strftime()]] - Format a Linux Timestamp using a format string
====See Also====
[[intval()]] - Return the integer value of a number or string
[[floatval()]] - Return the float value of a number or string
[[is_numeric()]] - Check if a value is numeric (int, float or numeric string)
[[uphp:variables|uPHP Variable Types and Limits]]