Home  >  Article  >  Backend Development  >  How to convert characters into numbers in php

How to convert characters into numbers in php

藏色散人
藏色散人Original
2020-07-03 09:53:343359browse

How to convert php to numbers: 1. Add the target type enclosed in parentheses before the variable to be converted; 2. Use the conversion function of the specific type of intval, floatval or strval; 3. Use "settype ();" method to convert.

How to convert characters into numbers in php

php converts characters into numbers

1. The first conversion method: Add the target type enclosed in parentheses before the variable to be converted, such as (int); (bool); (float); (string); (array); (object)

2. The second conversion method: use three specific types of conversion functions, intval(); floatval(); strval()

3. The third conversion method: settype();

Recommended: "PHP Tutorial"

The above is the detailed content of How to convert characters into numbers 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