A simple question,
Why PHP fetch()
transform INT
into STRING
?
Example :
- DATABASE structure :
is_active int(11)
- PHP fetch :
'is_active' => string '1' (length=1)
A simple question,
Why PHP fetch()
transform INT
into STRING
?
Example :
- DATABASE structure :
is_active int(11)
- PHP fetch :
'is_active' => string '1' (length=1)
In my opinion, it's for Trading off some of the performance and accessibility.
In short, if mysql uses only one-type(string) data, containers may have one-type tuple and does not need complex data structure.
For example, int is easy data-type. but there are int32, int64, unsigned int and every-databases has its own data-type, php could simplify what type is it. ie. we cannot simple say that varchar2 could be converted with string since there are text, varchar, varchar2, string.
In my opinion, The advantage of php is that it is easy for beginners to use. If PHP took type from database. It would have object such as DBResult { enum datatype, Object DataSet }
it seems complex and increase the size of the code.
String can contain every datatype except binary(blob) format.!
Thank you.