I think there is no use of data types in PHP as the PHP is a loosely type language.
It is true that the PHP is loosely typed, which means it calculates data types as data is assigned to each variable. But, this gives a mixed blessing. On the one hand, it means that variables can be used flexibly, holding a string at one point and an integer at another. On the other hand, this can lead to problems in larger scripts if you expect a variable to hold one data type when, in fact, it holds something completely different. You might have created code designed to work with an array variable, for example. If the variable in question contains a number value instead, errors might occur when the code attempts to perform array-specific operations on the variable.
Leave a Reply
You must be logged in to post a comment.