PHP mysql operation, why do you want to return an array of strings, do not return the real data type?

  ios, question

Return value
Returns an array of strings that corresponds to the fetched row or NULL if there are no more rows in resultset.

What is returned here is an array of strings, which returns string regardless of whether the data in the table is an integer or a floating point number. Why is it designed like this?

The disadvantage of this is that JSON will always be of string type, resulting in inaccurate data, which must be converted manually.

You probably wronged PHP.

Most programming languages directly use the C language library provided by mysql. (There are also many languages that use libraries written by themselves, such as java, the C language library applicable to the previous version, and the JDBC version later changed to Java native language).

Mysql. h defines in MySQL’s C language library header filemysql_fetch_rowFunctions:

MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);

The type returned isMYSQL_ROWType. This type is still defined in mysql.h:

typedef char **MYSQL_ROW;  /* return data as array of strings */

The notes that follow are very detailed.

Since there is no associative array in C language, mysql’s C language library is not available.mysql_fetch_arrayFunction, PHP should be inmysql_fetch_rowEncapsulated on the basis of.