When you are developing some application with PHP, then there might be a need to split the contents received from users or to split the contents which are stored in database and its a very common scenario where we can use PHP’s inbuilt function “explode”.

Splitted values can be used for manipulation as the values returned by explode function are “array”, so we can use it.

Checkout the following code its very simple to understand & use.

<?php
$string = "Some Contents Which Can Be Splitted With PHP Explode Function and Array can be Printed !";
$splitted = explode(" ",$string);
$cnt = count($splitted);
$i=0;
while($cnt > $i)
{
 echo "$splitted[$i]";
 echo "\n";
 $i++;
}
?>

Check PHP Manual for PHP Explode Function.


Get latest blog posts in your Mail ! Don't worry, I won't spam your Inbox, I hate spams too ! ! !