PHP explode() Function

PHP explode() function is often used to split a string into an array by a specified string.

Syntax

explode() Function Parameter

ParameterDescription
delimiter :Required parameter. The boundary string.
str :Required parameter. The input string.
limit :Required parameter. The number of array elements to be return.

  • If > 0 - Returns an array with mentioned limit elements.
  • If < 0 - Returns an array with mentioned limit - 1 elements.
  • 0 - Returns an array with one element

explode() Function Return Value

Return Value :Returns an string array splitted with delimiter.

explode() Function Example