Hello friends, today I will tell you through this post how you convert string into string through php without using explode function. So let’s go.
convert string to array with php without explode function, change string to array by php without explode function, convert string to array in php without explode Code Example
You can convert string to array by using str_split function. How will this function be used. You are explained below with example.
The str_split function used to partition of the string into equal length. Then the string part becomes an array element. The array element contains the remaining end string.
In our example, we pass 3 to create an array whose elements have three characters each:
$string = 'abcdefghijklmnopqrstuvwxyz';
// pass 3 to split $string into an array with elements 3 characters long
$split = str_split($string, 3);
// display result using print_r
/* View Source display:
 => abc
 => def
 => ghi
 => jkl
 => mno
 => pqr
 => stu
 => vwx
 => yz