Use str_pos to find the word LIMIT and then strip after that using substr
$string = 'SELECT * FROM `backplanechanneldecoder` WHERE Pair = 3 LIMIT 25,25';
$limit_pos = strpos($string, 'LIMIT');
$string = substr($string, 0, $limit_pos);
echo $string;
solved remove all text from string after given word in php [duplicate]