array_length()
Learn how to use the array_length() function to calculate the number of elements in a dynamic array.
Calculates the number of elements in a dynamic array.
Syntax
array_length(array)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| array | dynamic | ✔️ | The array for which to calculate length. |
Returns
Returns the number of elements in array, or null if array isn’t an array.
Examples
The following example shows the number of elements in the array.
print array_length(dynamic([1, 2, 3, "four"]))
Output
| print_0 |
|---|
| 4 |
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.