php method to convert numbers to strings: 1. Create a PHP sample file; 2. Define a number; 3. Convert the number to a character type through the "string strval (mixed $var)" method .
The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer
How does php convert numbers to strings?
strval() function is used to get the string value of a variable.
Syntax
string strval ( mixed $var )
Parameter description:
$var: Can be any scalar type, but cannot be an array or object.
Return value
Return string.
Example
The output result is:
int(123) string(3) "123"
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to convert numbers to strings in php. For more information, please follow other related articles on the PHP Chinese website!