- explode: documentation ( source)
- trim: documentation ( source)
- preg_replace: documentation ( source)
<?php
// main title of product
$maintitle = 'CHICKENBUFFET HOT WINGS';
// take first word from $maintitle and put in new variable
list($title1) = explode(' ', $maintitle);
// words that start with CHICKEN are removed and put in new variable
$title2 = preg_replace('/\w+BUFFET/', '', $maintitle);
// echo titles
echo $title1."\n";
echo trim($title2);