php - Divide the string into parts and convert it to an array
537
It is necessary to split the string every 500 symbols, and put every part into array.
Example:
$str = "xx...xxxx" (1550 symbols)
Result:
array(4) {
[0]=>
string(500) "xxx.xx"
[1]=>
string(500) "xxx.xx"
[2]=>
string(500) "xxx.xx"
[3]=>
string(50) "xxx.xx"
}
Tried this way, but this is not what I need:
$arr = str_split($str,500);
How to solve this problem in the best way?
Thnx!
Answer
Solution:
Here is solution for me
u_mulder, thanx for the hint with UTF encoding:)