This is my code:
$buscarSemana = array("Lunes", "Martes", "Miércoles", "Jueves", "Viernes");
$posicionCoincidencia = strpos("Viernes, agosto 14", in_array($buscarSemana));
if ($posicionCoincidencia === false) {
echo "NO se ha encontrado la palabra.";
} else {
echo "Éxito! Se ha encontrado la palabra.";
}
The text string can vary:
Viernes, agosto 14
Viernes, agosto 21
Jueves, agosto 27
I need to know if any of the words in the array $buscarSemna (Monday, Tuesday, Wednesday,...) is found in the text string.
Just loop through the array and compare with your string. It would be as follows:
Observe the dynamics, the variable $valor is taking the different values of the array and what we do is compare each value with our string. If we find a match we make our $found flag true.