How to convert a string in to array in php?
PHP has lots of built in string functions. PHP also has a string function which easily split a string into an array with the help of repeatable delimiter. The function name is explode, with 3 parameters to it.
Syntax of explode.
array explode( string $delimiter,string $string,[int $limit]);
function description explode
explode simply returns an array of strings, where each element of an array is nothing but a substring of string provided in variable $string. String is split on the basis of $delimiter.
1. string $delimiter
$delimiter can be a character or no of characters which occurs repeatedly in $string. It is nothing but a boundary for all substrings.
This is nothing but any string that is to be converted in array with the help of above delimiter.
Point to note.
1.What if delimiter is empty.
->If delimiter string is empty e.g. "" then explode() will simply return FALSE.
$string = 'php||explode||returns||array';
$delimiter = '||'
output of above snippet.
 => php
 => explode
 => returns
 => array
Converse function of explode
implode() : post coming soon.