Php explode function with example

Explode is function used in php which is used to split the string into array.Return an array format of substring of a defined string.

Syntax:

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

Description:

  • $delimiter : delimiter is nothing but a separator to split the string.

     eg(" ",  "-" ,"|"). some thing we need to separate Which is available in string.

  • $string : String is what we need to separate.
  • $limit : It should be a integer to split the string we defined.Its an optional parameter.

 

Example:

$string = "explodes | code | expertz | string."; 
print_r (explode(" | ",$string)); 

 

OUTPUT:

Category: