03.07.2013, 00:11
This is for all old strtok uses.
I build this function (strtok) from the beginning and i could optimize it by more than one and a half the original function:
In addition there's the option to insert the result into an array and not just return it.
Speed results:
Enjoy
I build this function (strtok) from the beginning and i could optimize it by more than one and a half the original function:
PHP код:
stock strtok(str[], &index, array[20] = ' ', dilimiter[2] = ' ') {
format(array, 20, str);
strdel(array, 0, index);
new pos = strfind(array, dilimiter, false);
if(pos == -1) array[index] = EOS;
else {
array[pos] = EOS;
index += pos;
}
index++;
return array;
}
Speed results:
Код:
< speed > Ron's strtok: 1100 < speed > Original strtok: 1791
