php 關聯陣列?枚舉數組?

來源:互聯網
上載者:User
關鍵字 php
請解釋一下請解釋一下請解釋一下請解釋一下

回複內容:

請解釋一下請解釋一下請解釋一下請解釋一下

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裡面的:

  • 索引數組[1,2,3,6,6,90]

  • 關聯陣列['a' => 1, 'b' => 9, 'f' => ko]

PHP中的枚舉數組也就是指的關聯陣列,關聯陣列的下標也就是key值可以是無序的,一般是字串類型;比如:
array('one'=>'1','three'=>'2', 'fore'=>'3');

索引數組的下標(key)是有序的,一般為int型,比如:
array('one', 'two', 'three')
這個數組預設的下標就是0,1,2;(另外:索引數組的下標預設從0開始)

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.