It seems like you are calling the size function count() as part of the test condition. You might want to compute the size beforehand, and not on each iteration.
If the size of the collection does not change during the iteration, it is
generally a good practice to compute it beforehand, and not on each iteration:
for($i=0;$i<count($array);$i++){// calls count() on each iteration}// Betterfor($i=0,$c=count($array);$i<$c;$i++){// calls count() just once}
Loading history...
42
if (self::isBoundary($splittedNeedle[$i])) {
43
return $i;
44
}
45
}
46
47
return -1;
48
}
49
50
/**
51
* @param array $splittedNeedle
52
*
53
* @return int
54
*/
55
private static function getLastBounduaryPosition($splittedNeedle)
56
{
57
for ($i=(count($splittedNeedle)-1); $i >= 0; $i--) {
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: