Home > Article > Backend Development > Can php strings be traversed?
Can php strings be traversed?
php strings can be traversed. Code examples such as:
<?php $temp='abcdefg'; //要遍历的字符串 $re=array(); //定义接受字符串的数组 for($i=0;$i<strlen($temp);$i++){ $re[]=substr($temp,$i,1); //将单个字符存到数组当中 echo $re[$i],','; } ?>
PHP related introduction:
1.PHP, a nested abbreviation name, is the abbreviation of English Hypertext Preprocessing Language (PHP: Hypertext Preprocessor). PHP is an HTML embedded language. PHP is somewhat similar to Microsoft's ASP. Both are scripting languages that are embedded in HTML documents and are executed on the server side. The style of the language is similar to C language. It is now used by many It is widely used by website programmers.
2.PHP’s unique syntax mixes C, Java, Perl and PHP’s self-innovated syntax. It can execute dynamic web pages faster than CGI or Perl.
3.PHP was originally developed by Ledolf in 1995; the standard of PHP is now maintained by the PHP Group. PHP uses PHP License as the license agreement, but because this agreement restricts the use of the PHP name, it is incompatible with the open source license agreement GPL.
For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of Can php strings be traversed?. For more information, please follow other related articles on the PHP Chinese website!