split a string into array of strings formed by the string delimiter.

If i have a string like :

$str=”D:/newfolder/kumar/gandhi”;

Then to seperate the string $str with ‘/’ as delemiter we have to use the function available explode() in PHP.

Its very usefull when we are sending group of data from Flex and splitting it using the function in PHP explode().For our calculation.

using the function :

$str1=explode(“/”,$str);

now using the string $str1 as array which contains the splitted string..

for($i=0;$i<=$str1.length;$i++)

{

echo $str1[$i].”</br>”;

}

Now this will print the string as –>

D:

newfolder

kumar

gandhi

Hence the usage of explode() function..

Leave a Reply