Home > Article > Backend Development > How to convert php string to number
php string to number method
There are two methods:
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()
For more related knowledge, please pay attention to PHP Chinese website! !
The above is the detailed content of How to convert php string to number. For more information, please follow other related articles on the PHP Chinese website!