Reputation: 3
$title = 'the.test.hd.part12';
I need to keep the characters up until it finds the word "part".
Should return - the.test.hd.
Upvotes: 0
Views: 1583
Reputation: 4197
For users on PHP Version < 5.3.0:
echo substr($title, 0, strpos($title, $needle));
Upvotes: 0