C in the Strlen function number "to determine whether the string is over, what about PHP?

Source: Internet
Author: User
c The strlen function number "\" to determine whether the string is over, what about PHP?


Reply to discussion (solution)

The PHP variable is a C-language structure,

Can you explain it in detail? I don't know much.

The string in PHP is implemented as a array of bytes and an integer indicating the length of the buffer.

PHP is written in C + +, it should also use "\ n"

The variable structure of PHP is as follows:

typedef struct _ZVAL_STRUCT Zval;typedef Union _zvalue_value {    long lval;                 /* Long value */    double dval;               /* Double value */    struct {/                   * String type */        char *val;        int len;    } STR;    HashTable *ht;             /* Hash Table value */    zend_object_value obj;} zvalue_value; struct _zval_struct {/    * Variable information */    zvalue_value value;        /* Value */    zend_uint refcount__gc;    Zend_uchar type;           /* Active type */    Zend_uchar is_ref__gc;};

And then you get the idea.

PHP variables have a save string length, so you don't need to use symbols to judge

Thank you,!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.