2024-06-07, 01:03 PM
Hello, I know that the size of an array must be defined by a constant, but is there any way to define the size based on a parameter or another array?
PHP Code:
stock GetStringPreview(string[],maxlength=25)
{
new preview[maxlength+3],len;
format(preview,maxlength,"%s",string);
if(strlen(string) > maxlength)
{
len = strlen(preview);
strins(preview, "...",((preview[len-1] == ' ') ? len-1 : len));
}
return preview;
}