PHP is a very weak type language, or a dynamic type language. In most programming languages, variables can only hold one type of data, and this type must be declared before use, such as C. In PHP, the variable type is determined by the value assigned to the variable.
For example, when we create two variables $totalqty and $totalamount, we determine their initial type, as follows:
$totalqty = 0;
$totalamount = 0.0;
Since we are assigning 0 to $totalqty, then $totalqty is a variable of integer type. Similarly, $TOTALAMOUNTJ is a variable of floating-point type. Strangely enough, we can add the following statement to the script:
$totalamount = ' Hello ';
The type of the variable $totalamount can be of type string. PHP can determine the data type of a variable at any time based on the value stored in the variable.
This ability to transparently change the variable type at any time is very useful.
Keep in mind that PHP will "automatically" get the input data type. Once the variable value is retrieved from the variable, it returns data with the same data type.
Http://bbs.hexun.com/stock/post_5_9809982_1_d.html
Http://bbs.hexun.com/stock/post_5_9810041_1_d.html
PHP basic PHP Data type strength