I have a question, I have a sentence that I need to eliminate certain content, but respecting the whole sentence. For example, the idea is to eliminate the characters that come after the word por
.
$string = "Hace hoy un buen día para pasear por 3 forques, y lo que sea.";
What I need you to return the phrase as follows:
Hace hoy un buen día para pasear
I'm doing it this way but I can not think of how to recover the sentence ..
preg_match("/por [0-9]{0,3}.+/", $string , $resultado);
// Devuelve-> "por 3 forques, y lo que sea."
What step am I missing?