PHP Developer Question:
Download Questions PDF

How to convert the strings to numbers in PHP?


In a numeric context, PHP will automatically convert any string to a numeric value. Strings will be converted into two types of numeric values, double floating number and integer, based on the following rules:

► The value is given by the initial portion of the string. If the string starts with valid numeric data, this will be the value used. Otherwise, the value will be 0 (zero).
► If the valid numeric data contains '.', 'e', or 'E', it will be converted to a double floating number. Otherwise, it will be converted to an integer.

Download PHP Developer Interview Questions And Answers PDF

Previous QuestionNext Question
How to convert the numbers to strings in PHP?How you can remove white spaces from the beginning and/or the end of a String in PHP?