I know “explode” splits the string and turns it into an array for every occurrence. But how do I split on the first occurrence and keep everything after the first occurrence?
Examples:
$split = explode('-', 'orange-yellow-red');
echo $split[1]; // output: "yellow"
^ I would like this to output: yellow-red
$split = explode('-', 'chocolate-vanilla-blueberry-red');
echo $split[1]; // output: "vanilla"
^ I would like this to output: vanilla-blueberry-red
You can pass the
limitas the third parameter ofexplodethat will do the job.