$str = "Apples and Oranges and Bananas and Grapes are tasty";
$delimiter = "and";
// Split the string by the delimiter
$parts = explode($delimiter, $str);
foreach ($parts as $part) {
echo trim($part) . "\n";
}
/*
run:
Apples
Oranges
Bananas
Grapes are tasty
*/