Home  >  Article  >  Backend Development  >  How to convert int to string in php?

How to convert int to string in php?

coldplay.xixi
coldplay.xixiOriginal
2020-07-16 14:58:309834browse

How to convert int to string in php: first convert int to Integer type; then call the toString method, the code is [Intrger i2 = new interger(i); String s3 = i2.toString() ;].

How to convert int to string in php?

How to convert int to string in php:

Method 1: i plus space method

String s1 = i + " ";

Method 2: Assign valueof(i) to i

String s2 = String.valueof(i);

Method 3: Convert to Integer type first, then call toString method

Intrger i2 = new interger(i);
 String s3 = i2.toString();

Method 4: toString method

String s4 = Integer.toString(i);

Related learning recommendations: PHP programming from entry to proficiency

The above is the detailed content of How to convert int to string 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