PHP String Length Without strlen()

前端 未结 3 1144
北恋
北恋 2021-01-20 03:37

Just browsing over the latest release of the PHP coding standards, and something caught my eye:

http://svn.php.net/viewvc/php/php-src/trunk/CODING_STANDARDS?revision

3条回答
  •  伪装坚强ぢ
    2021-01-20 04:06

    To get the length of a string zval (variable in C) use Z_STRLEN(your_zval) see zend_operators.h at line 398 (PHP 5.4) :

    #define Z_STRLEN(zval)          (zval).value.str.len
    

提交回复
热议问题