In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail the interview questions about variables and date processing in PHP. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Variable correlation
Internal implementation of PHP variable
The system types of programming languages are divided into strong types and weak types:
Strongly typed language is that once a variable is declared as a variable of a certain type, it cannot be assigned a value other than the type of the variable while the program is running. Languages such as c/c++/java fall into this category.
Scripting languages such as php and ruby,javascript are weakly typed: a variable can represent any data type.
Php variable types and storage structure
Php does not need to explicitly specify its data type when declaring or using variables
Php is a weakly typed language, which does not mean that php has no types. In php, there are eight variable types, which can be divided into three categories:
Scalar type: boolean,integer,float,string
Compound type: array,object
Special type: resource,NULL
Variable storage structure
The value of the variable is stored in the zval structure shown below. Its structure is as follows:
Typedef struct _ zval_struct zval; struct _ zval_struct {zvalue_value value; / / value of the stored variable zend_uint refcount__gc; / / indicates reference count zend_uchar type; / / the specific type of the variable zend_uchar is_ref_gc; / / indicates whether it is a reference}
The value of the variable is stored in another structure, zvalue_value
Variable type
The type field of zval structure is the most critical field to achieve weak typing. The value of type can be: IS_NULL, IS_BOOL, IS_LONG, IS_DOUBLE, IS_STRING, IS_ARRAY, IS_OBJECT, IS_RESOURCE. Literally, it is easy to understand that they are just the only indication of the type, storing different values in the value field according to the type.
Storage of variable value
The value of the variable mentioned earlier is stored in the zvalue_value structure, which is defined as follows:
Typedef union _ zvalue_value {long lval; double dval; struct {char * val; int len;} str; HashTable * ht; zend_object_value obj;} _ zvalue_value
Date correlation
Calculate the number of days between two dates
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.