How To Convert Strings To Numbers In PHP

  • 31 Jan, 2012

    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.

    Comments Received:
    Please give your suggestions and feedback:

2009-2016 All rights reserved.