Count Array Records function
#1

Hey,
I have a little question:
Is there any function to count the number of records in an array?
Like this PHP function: http://php.net/manual/en/function.count.php

PS. I have searched the forum and the wiki, but can't find anything helpful.
Reply
#2

I was thinking this function counts the number of characters in a string, but it counts the number of records in an array? Am I correct?
Reply
#3

you make a variable, let's say this one
pawn Код:
new myArray[6]; //6 "records" as you call it
then if I do sizeof(myArray), it will return 6.
even if I set like
myArray[0] = 2;
myArray[1] = 6;

It'll still return 6, since the number of arrays will still be the same
Reply
#4

Thanks for your reply.
So, is it possible to create an array without defining how much records there will be in?

Is something like this possible?
Код:
new myArray;
myArray['key1'] = "value1";
myArray['key2'] = "value2";
myArray['key3'] = "value3";
myArray['key4'] = "value4";

sizeof(myArray); // Will return 4?
Reply
#5

if you use new myArray[] yes, if I understanded your question correctly (you still need to create braces)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)