Skip navigation.
Home

zend_string_to_double()

Converts a char* into a double

zend_string_to_double(const char *number, zend_uint length)


Returns:

double

Parameters:

type parameter description
const char* number string you wish to convert to a number
zend_uint length number of characters from the string to convert, starting from the beginning. If 0 this function will return 0.0.

Convert a string into a double, if the string contains an E or e, the numbers after it will be used as an exponent; for example "2E2" will become 200.0

Example:

d = zend_string_to_double("34.54", 5);