When using , in fact, the PHP string principle is a character array. Suppose we define a string
- < ?
- $string ="hello world";
- /*
- This string is composed of h , e , l , l , o , space
, w ,o,r ,l,d are composed of these characters. As for what ends with
, I can understand it now. You may need to check the original PHP code to find out - */
- //What is the basis for what I said above? The following can be tested
- echo $string[2];
//The third character l is displayed, we can try to change - $string[2]="A";
//Change one of the characters; - echo $string;
// Get heAlo world - //Then we can try to change $string[2] to string
- $string[2]="AAAAAA";
/ /Test to see if PHP will overwrite the characters behind it - echo $string;
// Get heAlo world, haha It seems that PHP has done safety processing - ?>
How about, through the above code examples, can you clearly understand the PHP string principle? Everyone can slowly experience it in actual operations in the future.
http://www.bkjia.com/PHPjc/446264.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446264.htmlTechArticleIn fact, when using PHP string principle, it is a character array. Suppose we define a string? $ string = helloworld; /* This string is composed of the characters h, e, l, l, o, space, w, o, r, l, d...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn