Home  >  Article  >  Backend Development  >  How to convert numbers to strings in php

How to convert numbers to strings in php

藏色散人
藏色散人Original
2022-01-28 09:36:573376browse

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 .

How to convert numbers to strings in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn