PHP code to Seprate a string into array of strings on base of a character or string in
Posted On at by milanIn case in php you have a string and you want to separate it into array of sub-strings on base of a separated character or string using php solution is simple.
For this we will use php explode function with a seprator and a string. Seprater may be any character of sub string.
array=explode(seprator,string);
See following example
$string1= "this is car and he is boy";
$strAry= explode("and",$string1);
Now after execution created array will be in following state
$strAry[0] => this is car
$strAry[1] => he is boy