You are not restricted in WinRunner to only use numbers in an array, as it is treated more like a hash than a true array.
array = X;
array["one"] = X;
are both valid in WinRunner. So when you pull back the count of elements, you need to make sure the code you are using to build the array adheres to a format which you are expecting and understand, or the number is meaningless.
Just a slight mod from the code supplied liujinkui:
<font class="small">Code:</font><hr /><pre>
public function array_ele_count(inout p_arr)
for (loop in p_arr)
I do not have WinRunner in front of me and have not used the tool for over 2 years now, but I think that function is done correctly to work