I have the following code which takes rediculously long time to execute. Sometimes it even times out.
foreach ($totalownerships as $totalownership) {
if (!in_array($totalownership['titleno'], $totaltitles)) {
$result['totalowns'] += 1;
$totaltitles[] = $totalownership['titleno'];
$result['ownershipid'] = $result['ownershipid'] . " " .$totalownership['titleno'];
}
}
The $totalownerships
array size is 52225
. Is there a better way of writing this code so that it doesn'e take long time to execute ?