So, i have an exercise , i did some research and managed to preg_split my string by dots. Now i've got an Array the way i want it to be and i want to get inside the elements of this Array so i can count the words in each one of the elements. Can i have some help with this one? The $test string is in Greek.
$test = "Αυτή είναι η 1η δοκιμασία. Πρέπει να την ολοκληρώσω. Ώστε να μου δώσουν την 2η δοκιμασία. Και τέλος, την 3η δοκιμασία." ;
$res = preg_split ("/(.*?\.*?)\../", $test, NULL,
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
print_r($res);
the result is something like this:
Array
(
[0] => Αυτή είναι η 1η δοκιμασία
[1] => Πρέπει να την ολοκληρώσω
[2] => Ώστε να μου δώσουν την 2η δοκιμασία
[3] => Και τέλος, την 3η δοκιμασία.
)
and as i said earlier i want to access every element (e.g [0], [1], [2], [3]) and print the number of words each one of them has. But i can not find the way how...