Home >Backend Development >PHP Tutorial >Two ways to split strings word by word in PHP_PHP tutorial
Method one:
Note: 1. The $charset variable is the web page encoding, such as "gb2312" or "utf-8";
2. The first method requires that the server must enable the mbstring.dll extension, otherwise the code will execute incorrectly, so for those who use virtual hosts, you can consider using the second method.
Method 2: 127?$str[$i].$str[++$i]:$str[$i]; } return $arr; } $arr=str_to_arr($str); ? >