← All built-ins / explode()
explode()
explode(string $haystack, string $needle): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $separator | string | delimiter (cannot be empty) |
| $s | string | string to split |
Return value
Array of the pieces between separators.
Example
$p = explode(",", "a,b,c");
echo count($p), " ", $p[1], "
";
echo explode("/", "2024/03/15")[2], "
";3 b 15