How to use explode in PHP

In this article, I will explain how the explode() function can be used in PHP.
  • 1272

explode() function in PHP

  • The explode() function is used to break a string into an array.
  • In explode() function, Separator cannot be an empty string.




  • separator string is required parameter. It is boundary where to break the string.
  • string string is required parameter. the string to be split
  • limit limit is optional parameter. the maximum number of elements in the output array.


The following example show to how the explode() function can be used in PHP.



<h3 style="color: blueviolet;">explode() function example in PHP</h3>


    $str = "Welcome to all C-sharpcorner user's <br/> Have a nice day....".'<br/>';

    print_r(explode(" ",$str));






You may also want to read these related articles here
Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2019 DotNetHeaven. All rights reserved.