How to explode string in PHP?

Edit answer History

An explode is the process of converting the characters of the string into smaller pieces. A string is the sequence of characters with some size limit.

The string which you want to explode can be a sentence which you can break into some parts which can be smaller or some combination of characters.

We can use PHP explode function to convert a string of characters into an array. explode() syntax:

explode(String $delimiter, String $string, int $limit );

For example:

$string = "Foo Bar PHP";
$array = explode(' ', $string);

$array is:

Array ( [0]( => 'Foo' [1]( => 'Bar' [2]( => 'PHP' )

The question has no categories yet.

add Login to add categories
Answer contributors
Андрей Ликарин
Authors of the answer are users who wrote the first or added to an existing answer. Other types of contributions to answering questions are also taken into account.
Top contributors
Андрей Ликарин
Андрей Ликарин

Учитель русского языка и литературы

About Answeropedia

Answeropedia is like Wikipedia, only for questions and answers. You ask a question and get one complete, comprehensive and competent answer from the community.

About question
  • 1 contributor
  • Updated 24 Sen at 12:34 pm