in reply to How do I find the array element directly preceeding a 'match'?

Or you could just use a for loop, and eliminate the need for multiple assignments:
for ($i=0; $i<scalar(@array); ++$i) { last if (matches($array[$i])); } $found = $array[$i-1] if ($i);
  • Comment on Re: How do I find the array element directly preceeding a 'match'?
  • Download Code