$str = "php c c++ java rust";
// Split the string into words
$words = explode(' ', $str);
// Calculate the middle index
$midIndex = floor(count($words) / 2);
// Create a new string without the middle word
$result = implode(' ',
array_merge(array_slice($words, 0, $midIndex), array_slice($words, $midIndex + 1)));
echo $result;
/*
run:
php c java rust
*/