Home >Backend Development >PHP Tutorial >String increment problem in php
The following code is shown:
$str = 'W'; for( $i=0; $i<br>The following results will appear: <p><img src="/static/imghwm/default1.png" data-src="http://image.codes51.com/Article/image/20150826/20150826104722_0838.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p><p>This is because php follows Perl's habits when processing strings, not C's. P For example, er er </p> $ a = 'z'; $ a ++; <p> will turn </p> $ a<p> to <em>'aa'</em><em></em><em> and in c, </em>a = 'z'; a ++ ;</p> will turn <p>a<em> into <em>'['</em> (the ASCII value of <em>'Z'</em> is 90, and the ASCII value of <em>'['</em> is 91). <em></em><em></em></em></p><p><em><br>Character variables can only be incremented, not decremented, and only support pure letters (a-z and A-Z). Incrementing/decrementing other character variables is invalid and the original string will not change. </em></p><p><em><br>Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission. </em></p> <div> The above introduces the problem of string increment in PHP, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials. <p> </p> </div>