October 2005
Intermediate to advanced
372 pages
11h 35m
English
explode()
array explode ( stringseparator, stringinput[, intlimit] )
The explode()
function converts a string into an array using a separator value. For example, the string "head, shoulders, knees, toes" could be converted to an array with the values heads, shoulders, knees, toes by using the separator ",". Note that the separator is a comma followed by a space, otherwise the array values would be heads, shoulders, knees, and toes. For example:
$oz = "Lions and Tigers and Bears";
$oz_array = explode(" and ", $oz);
// array contains "Lions", "Tigers", "Bears"To reverse this function, converting an array into a string by inserting a separator between elements, use the implode() function.