PHP Explode Function – Split Strings with PHP Explode Function


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.

ProWebGuru: Mostly I write about technology related stuff on https://www.prowebguru.comRecently I have started making videos also. Mostly blog posts & videos are related to technology, programming and learning some new tips and tricks related to windows, wordpress, google app script, technical, programming, javascript, jquery and other coding related stuff.Youtube channel - https://www.youtube.com/user/prowebguru

This website uses cookies.