The split function in PHP is deprecated by the explode function.
When you want to split a string by a string in PHP, you should use the explode function. It separates a string into an array of strings by splitting them according to the delimiter string which is mostly known as separator. In other words, it returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter.(1)
|delimiter||The boundary string.|
|string||The input string.|
|limit||If limit is set and positive, the returned array will contain a maximum of limit elements with the last element containing the rest of string. If the limit parameter is negative, all components except the last -limit are returned. If the limit parameter is zero, then this is treated as 1.|
In this example, I used the explode function to split a string named content two times with two different separators. I did not use limit parameters but you can add it to the code if you want.
$content = "Hello-my-name-is,John-Doe-and,-I-am-working-on,PHP";
$splitInComma = explode(",", $content);
$splitInDash = explode("-", $splitInComma);
$firstName = $splitInDash;