PHP | explode() Function

PHP explode() Function

Hello folks! welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP explode() Function.

The PHP explode() function breaks a string into an array. This function has a separator parameter, which can not contain an empty string, because it holds the original string to be split.

Note: This PHP function is binary safe.


Following below is the syntax to use this function -

array explode ( string $delimiter , string $string [, int $limit ] )

Parameter Details

Sr.NoParameters & Description


The boundary string.

Return Value

This PHP function returns an array of string created by splitting the string parameter on boundaries formed by the separator.


Try out the example below -

   $str = "webdesigntutorialz best online learning platform.";
   print_r (explode(" ",$str));


When the above code is executed, it will produce the following result -

Array ( [0] => webdesigntutorialz [1] => best [2] => online [3] => learning [4] => platform. )

Alright guys! This is where we are going to be rounding up for this tutorial post. In our next tutorial, we will be studying about the PHP fprintf() Function.

Feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.