i've a logical problem that i don't know how to solve, i'm a lot confused about it.
I've an array composed in this way:
titoli[
1 => 'NFL'
2 => 'Johnny Depp'
3 => 'Institute of Technology'
4 => 'Another text'
]
Now, I need to apply different regex to that array, how can i do that and have a single final array?
For now i've written this:
for($i=0;$i<sizeof($titoli);$i++)
{
if(str_word_count($titoli[$i]) > preg_match_all('/([A-Z][a-zA-Z0-9-]*)([\s][A-Z][a-zA-Z0-9-]*)+/', $titoli[$i]))
{
preg_match('/([A-Z][a-zA-Z0-9-]*)([\s][A-Z][a-zA-Z0-9-]*)+/', $titoli[$i], $result[$i]);
$i++;
}
if(str_word_count($my_array[$i]) > preg_match_all('/^[A-Z][a-z]* [a-z]+ [A-Z][a-z]*$/', $titoli[$x]) && preg_match_all('/^[A-Z][a-z]* [a-z]+ [A-Z][a-z]*$/', $titoli[$i]) > 0) //controlla che nel titolo non siano state messe tutte le parole con l'iniziale maiuscola
{
preg_match('/^[A-Z][a-z]* [a-z]+ [A-Z][a-z]*$/', $titoli[$x], $result_b[$y], PREG_PATTERN_ORDER);
$y++;
}
}