Let's say I've a small array () :
$array = array(
'Pantin',
'Paris',
'Paris',
'Puhahaa',
'Ptdr',
'Roumanie',
'Rlolo'
);
What I want to do? Simply get all words that start with the 'r' letter
$dataLen = sizeof($array);
$results = array();
for ($i = 0; $i < $dataLen && count($array) < 10; $i++) {
if (stripos($array[$i], 'r', 0)) { //
array_push($results, $array[$i]);
}
}
print_r($results); // Output : Array ( [0] => Paris [1] => Paris [2] => Ptdr )
I can't understand.. I put 0 as the offset, but it gives me words that start with the P letter and that "contain" the R letter.