How I can convert string into array?
Use
<?php $str = "Test"; $str_array = str_split($str); echo $str_array[1]; // it will output 'e' ?>
Or if you preferr
<?php $str = "test string"; echo $str{3}; // will output 't' ?>
or if you mean to turn a string into an array with only one element
$string=Array($string);
How about another version? :-)
$string = 'she told me to do it'; $arr = explode(' ', $string); echo $arr[2]; // me echo $arr[4]; // do
That's the question: what is meant by "string into array"? where does one array element leave off and the next begin?