Cut a string to a special character in PHP


I'm searching a function to cut the following string and get all content BEFORE and AFTER

I need this part<!-- more -->and also this part

Result should be

$result[0] = "I need this part"
$result[1] = "and also this part"

Appreciate any help!

Use the explode() function in PHP like this:

$string = "I need this part<!-- more -->and the other part.
$result = explode('<!-- more -->`, $string) // 1st = needle -> 2nd = string

Then you call your result:

echo $result[0]; // Echoes: I need that part
echo $result[1]; // Echoes: and the other part.