PHP explode() function breaks a string into parts. You can specify any character (which should be present in the string) to break it up into two or more segments. The function accepts two main parameters:
- separator
- string
$contact = "fname|lname|address|phone|email";
$details = explode("|", $contact);
The string is stored in $contact variable. We use the pipe “|” character as a separator that will be used to split the string into segments.