I just want to ask that I want to remove the last OR from following string.
$string = 'b.dates LIKE "2017-10-13%" OR
b.dates LIKE "2017-10-14%" OR
b.dates LIKE "2017-10-15%" OR
b.dates LIKE "2017-10-16%" OR
b.dates LIKE "2017-10-17%" OR';
$ character indicates the end of string.
preg_replace("/OR$/", '', $str );
or
rtrim($str, ' OR');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With