Small problem about foreach and strcmp
#6

You can reverse the iterator and it's always good to check if the string is not null before comparing it with another string.

PHP код:
CheckServerIp(string[])
{
    foreach(new 
Reverse(VirtualServer))
    {
        if (!
isnull(VirtualServerInfo[i][sIP]) && !strcmp(VirtualServerInfo[i][sIP], string)) return i;
    }
    return -
1;

Reply


Messages In This Thread
Small problem about foreach and strcmp - by AlexBlack - 14.03.2016, 13:53
Re: Small problem about foreach and strcmp - by Threshold - 14.03.2016, 14:13
Re: Small problem about foreach and strcmp - by AlexBlack - 14.03.2016, 14:17
Re: Small problem about foreach and strcmp - by Threshold - 14.03.2016, 15:26
Re: Small problem about foreach and strcmp - by AlexBlack - 14.03.2016, 15:40
Re: Small problem about foreach and strcmp - by Konstantinos - 14.03.2016, 16:08
Re: Small problem about foreach and strcmp - by AlexBlack - 14.03.2016, 16:47
Re: Small problem about foreach and strcmp - by AlexBlack - 21.04.2016, 10:50

Forum Jump:


Users browsing this thread: 1 Guest(s)