Why not:

```
foreach (array_reverse($clientIps) as $clientIp) {
    foreach ($trustedProxies as $trustedProxy) {
        if (IpUtils::checkIp($clientIp, $trustedProxy)) {
            continue;
        }
    }

    return $clientIp;
}
```