The problem is as follows: php does not need to declare variables. Does the system know what variables are and allocate space to them based on $? Does it need to declare variables because php is a weak language? The problem is as follows: php does not need to declare variables. Does the system know what variables are and allocate space to them based on $? Does it need to declare variables because php is a weak language?
Reply content:
The problem is as follows: php does not need to declare variables. Does the system know what variables are and allocate space to them based on $? Does it need to declare variables because php is a weak language?
The underlying C of php is stored by a consortium union, which contains various variable types. php uses the long type to store integers and hashtable Hasse tables to store arrays, because union can store various variables, and the interpreter will automatically determine the variable type, php does not need to declare the variable type, weak type
Yes, because php is a weak type language, you can use it without declaring the variable type ..
$ Is just a syntactic sugar, indicating that it is followed by a variable ..
If the explanation is based on the memory space allocation
When allocating memory space for weak variables, this memory space can store any type of variables. You need to find all memory areas when using
The strong type is allocated to the specified memory according to the variable type, and the type cannot be converted directly. You can find this value in this type of area when using it.
Therefore, you can directly modify the variable type in a weak language .. However, a strong language cannot be directly modified. Therefore, the pointer concept of a strong language is particularly important. we do not directly use data in the memory. we create a reference variable (pointer ), if you want to modify the memory address pointed to by the pointer, you can.
.