請解釋一下請解釋一下請解釋一下請解釋一下
回複內容:
請解釋一下請解釋一下請解釋一下請解釋一下
struct {union {long lval;double dval;struct {char *val;int len;} str;HashTable *ht;zend_object_value obj;} value;zend_uint refcount;zend_uchar type;zend_uchar is_ref;} zval; PHP_FUNCTION(explain){zval *uservar;if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", uservar) == FAILURE) {RETURN_NULL();}switch (Z_TYPE_P(uservar)) {case IS_NULL:php_printf("NULL ");break;case IS_BOOL:php_printf("Boolean: %s ", Z_LVAL_P(uservar) ? "TRUE" : "FALSE");break;case IS_LONG:php_printf("Long: %ld ", Z_LVAL_P(uservar));break;case IS_DOUBLE:php_printf("Double: %f ", Z_DVAL_P(uservar));break;case IS_STRING:php_printf("String: ");PHPWRITE(Z_STRVAL_P(uservar), Z_STRLEN_P(uservar));php_printf(" ");break;case IS_RESOURCE:php_printf("Resource ");break;case IS_ARRAY:php_printf("Array ");break;case IS_OBJECT:php_printf("Object ");break;default:php_printf("Unknown ");}RETURN_TRUE;}
php沒有數組,實際上是用的Hashtable,數組的叫法是誤傳,就象世上本沒有路,走的人多了,就把走過的地方叫路
我只知道PHP裡面的:
PHP中的枚舉數組也就是指的關聯陣列,關聯陣列的下標也就是key值可以是無序的,一般是字串類型;比如:
array('one'=>'1','three'=>'2', 'fore'=>'3')
;
索引數組的下標(key)是有序的,一般為int
型,比如:
array('one', 'two', 'three')
這個數組預設的下標就是0,1,2
;(另外:索引數組的下標預設從0開始)